Views
No views yet
6outof6(x0, x1, x2, x3, x4, x5) = 1 if (x0 + x1 + x2 + x3 + x4 + x5) >= 6| Hamming Weight | Output |
|---|---|
| 0 | 0 |
| 1 | 0 |
| 2 | 0 |
| 3 | 0 |
| 4 | 0 |
| 5 | 0 |
| 6 | 1 |
| Circuit | Bias | Fires when |
|---|---|---|
| 1-out-of-6 | -1 | HW >= 1 |
| 2-out-of-6 | -2 | HW >= 2 |
| 3-out-of-6 | -3 | HW >= 3 (majority) |
| 4-out-of-6 | -4 | HW >= 4 |
| 5-out-of-6 | -5 | HW >= 5 |
| 6-out-of-6 | -6 | HW = 6 (AND) |
| Weights | [1, 1, 1, 1, 1, 1] |
| Bias | -6 |
| Inputs | 6 |
| Outputs | 1 |
| Neurons | 1 |
| Layers | 1 |
| Parameters | 7 |
| Magnitude | 12 |
1from safetensors.torch import load_file
2import torch
3
4w = load_file('model.safetensors')
5
6def at_least_6_of_6(bits):
7 inputs = torch.tensor([float(b) for b in bits])
8 return int((inputs @ w['neuron.weight'].T + w['neuron.bias'] >= 0).item())
9
10print(at_least_6_of_6([1, 1, 1, 1, 1, 1, 0, 0, 0])) # 0 or 1 depending on k