File size: 1,425 Bytes
8638f54 51c400d 8638f54 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | ---
license: mit
tags:
- pytorch
- safetensors
- threshold-logic
- neuromorphic
---
# threshold-not
The minimal threshold circuit. One neuron, one weight, one bias.
## Circuit
```
x
β
βΌ
βββββββββ
β w: -1 β
β b: 0 β
βββββββββ
β
βΌ
NOT(x)
```
## Mechanism
A threshold neuron fires when its weighted input plus bias reaches zero. NOT uses weight -1 and bias 0:
- Input 0: sum = 0, fires (output 1)
- Input 1: sum = -1, silent (output 0)
The negative weight flips the relationship between input magnitude and firing.
## Parameters
| | |
|---|---|
| Weight | -1 |
| Bias | 0 |
| Total | 2 parameters |
## Optimality
Exhaustive enumeration of all 5 weight configurations at magnitudes 0-1 confirms this circuit is **already at minimum magnitude (1)**. There is exactly one valid configuration at magnitude 1, and no valid configurations exist below it.
## Properties
- Involutive: NOT(NOT(x)) = x
- Foundation for NAND, NOR
## Usage
```python
from safetensors.torch import load_file
w = load_file('model.safetensors')
def not_gate(x):
return int(x * w['weight'].item() + w['bias'].item() >= 0)
```
## Files
```
threshold-not/
βββ model.safetensors
βββ model.py
βββ config.json
βββ README.md
```
## License
MIT
|