Threshold Logic Circuits
Collection
Boolean gates, voting functions, modular arithmetic, and adders as threshold networks.
•
248 items
•
Updated
•
1
Maximum of two 2-bit unsigned integers.
max2(a, b) = max(a, b) where a, b are 2-bit unsigned (0-3)
| a | b | max(a,b) |
|---|---|---|
| 0 | 0 | 0 |
| 1 | 2 | 2 |
| 2 | 1 | 2 |
| 3 | 3 | 3 |
| 0 | 3 | 3 |
| 3 | 0 | 3 |
7-layer circuit:
| Inputs | 4 (a1, a0, b1, b0) |
| Outputs | 2 (m1, m0) |
| Neurons | 31 |
| Layers | 7 |
| Parameters | 180 |
| Magnitude | 96 |
from safetensors.torch import load_file
w = load_file('model.safetensors')
# See create_safetensors.py for full implementation
MIT