Views
No views yet
| a | b | c | sum | out |
|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 0 |
| 0 | 0 | 1 | 1 | 0 |
| 0 | 1 | 0 | 1 | 0 |
| 0 | 1 | 1 | 2 | 1 |
| 1 | 0 | 0 | 1 | 0 |
| 1 | 0 | 1 | 2 | 1 |
| 1 | 1 | 0 | 2 | 1 |
| 1 | 1 | 1 | 3 | 1 |
| Inputs | 3 |
| Outputs | 1 |
| Neurons | 1 |
| Layers | 1 |
| Parameters | 4 |
| Magnitude | 5 |
1from safetensors.torch import load_file
2import torch
3
4w = load_file('model.safetensors')
5
6def majority3(a, b, c):
7 inp = torch.tensor([float(a), float(b), float(c)])
8 return int((inp @ w['neuron.weight'].T + w['neuron.bias'] >= 0).item())
9
10print(majority3(0, 1, 1)) # 1
11print(majority3(0, 0, 1)) # 0