metadata
license: mit
tags:
- pytorch
- safetensors
- threshold-logic
- neuromorphic
threshold-7outof8
Near-unanimity detector. Fires when 7 or more of 8 inputs are set.
Circuit
xβ xβ xβ xβ xβ xβ
xβ xβ
β β β β β β β β
ββββ΄βββ΄βββ΄βββΌβββ΄βββ΄βββ΄βββ
βΌ
βββββββββββ
β w: all 1β
β b: -7 β
βββββββββββ
β
βΌ
HW β₯ 7
Mechanism
- Sum = (number of 1s) - 7
- Fires when Hamming weight β₯ 7
Tolerates exactly one missing input. Almost-AND.
k-out-of-8 Family
| Circuit | Bias | Fires when |
|---|---|---|
| ... | ... | ... |
| 6-out-of-8 | -6 | HW β₯ 6 |
| 7-out-of-8 | -7 | HW β₯ 7 (this) |
| 8-out-of-8 | -8 | HW = 8 |
Parameters
| Weights | [1, 1, 1, 1, 1, 1, 1, 1] |
| Bias | -7 |
| Total | 9 parameters |
Usage
from safetensors.torch import load_file
import torch
w = load_file('model.safetensors')
def at_least_7(bits):
inputs = torch.tensor([float(b) for b in bits])
return int((inputs * w['weight']).sum() + w['bias'] >= 0)
Files
threshold-7outof8/
βββ model.safetensors
βββ model.py
βββ config.json
βββ README.md
License
MIT