metadata
license: mit
tags:
- pytorch
- safetensors
- threshold-logic
- neuromorphic
threshold-max2
Maximum of two 2-bit unsigned integers.
Function
max2(a, b) = max(a, b) where a, b are 2-bit unsigned (0-3)
Truth Table (selected)
| a | b | max(a,b) |
|---|---|---|
| 0 | 0 | 0 |
| 1 | 2 | 2 |
| 2 | 1 | 2 |
| 3 | 3 | 3 |
| 0 | 3 | 3 |
| 3 | 0 | 3 |
Architecture
7-layer circuit:
- Compare high bits, compare low bits
- Compute a1 == b1
- Compute partial comparison results
- Compute a > b, a == b
- Compute a >= b
- MUX components
- Final output selection
Parameters
| Inputs | 4 (a1, a0, b1, b0) |
| Outputs | 2 (m1, m0) |
| Neurons | 31 |
| Layers | 7 |
| Parameters | 180 |
| Magnitude | 96 |
Usage
from safetensors.torch import load_file
w = load_file('model.safetensors')
# See create_safetensors.py for full implementation
License
MIT