--- license: mit tags: - pytorch - safetensors - threshold-logic - neuromorphic --- # threshold-xor4 4-input XOR gate. Cascade of three standard XOR circuits (OR + NAND + AND). ## Architecture ``` a b c d │ │ │ │ └──┴──┐ │ │ ▼ │ │ ┌─────┐ │ │ │ XOR │ │ │ └──┬──┘ │ │ └──┬─┘ │ ▼ │ ┌─────┐ │ │ XOR │ │ └──┬──┘ │ └────┬────┘ ▼ ┌─────┐ │ XOR │ └──┬──┘ ▼ XOR4(a,b,c,d) ``` Each XOR uses the standard OR + NAND + AND structure: - OR: w=[1,1], b=-1 (magnitude 3) - NAND: w=[-1,-1], b=1 (magnitude 3) - AND: w=[1,1], b=-2 (magnitude 4) ## Parameters | | | |---|---| | Neurons | 9 | | Layers | 6 | | Parameters | 27 | | Magnitude | 30 | ## Optimized Version See `threshold-xor4-mag21` for a 30% magnitude reduction using optimized XOR blocks. ## Usage ```python from safetensors.torch import load_file w = load_file('model.safetensors') # See model.py for implementation ``` ## License MIT