Views
No views yet
x₀ x₁ x₂ x₃ x₄ x₅ x₆ x₇
│ │ │ │ │ │ │ │
└──┴──┴──┴──┼──┴──┴──┴──┘
▼
┌─────────┐
│ w: all 1│
│ b: -5 │
└─────────┘
│
▼
HW ≥ 5| Circuit | Bias | Fires when |
|---|---|---|
| ... | ... | ... |
| 4-out-of-8 | -4 | HW ≥ 4 |
| 5-out-of-8 | -5 | HW ≥ 5 (this = majority) |
| 6-out-of-8 | -6 | HW ≥ 6 |
| ... | ... | ... |
| Weights | [1, 1, 1, 1, 1, 1, 1, 1] |
| Bias | -5 |
| Total | 9 parameters |
1from safetensors.torch import load_file
2import torch
3
4w = load_file('model.safetensors')
5
6def majority(bits):
7 inputs = torch.tensor([float(b) for b in bits])
8 return int((inputs * w['weight']).sum() + w['bias'] >= 0)threshold-5outof8/
├── model.safetensors
├── model.py
├── config.json
└── README.md