Views
No views yet
| Input | Output |
|---|---|
| 0001 | 1000 |
| 1000 | 0001 |
| 0110 | 0110 |
| 1010 | 0101 |
| Output | Copies from | Weights [a3,a2,a1,a0] | Bias |
|---|---|---|---|
| y3 | a0 | [0, 0, 0, 1] | -1 |
| y2 | a1 | [0, 0, 1, 0] | -1 |
| y1 | a2 | [0, 1, 0, 0] | -1 |
| y0 | a3 | [1, 0, 0, 0] | -1 |
| Inputs | 4 |
| Outputs | 4 |
| Neurons | 4 |
| Layers | 1 |
| Parameters | 8 |
| Magnitude | 8 |
1from safetensors.torch import load_file
2import torch
3
4w = load_file('model.safetensors')
5
6def reverse4(a3, a2, a1, a0):
7 inp = torch.tensor([float(a3), float(a2), float(a1), float(a0)])
8 return [int((inp @ w[f'y{i}.weight'].T + w[f'y{i}.bias'] >= 0).item())
9 for i in [3, 2, 1, 0]]
10
11print(reverse4(1, 0, 0, 0)) # [0, 0, 0, 1]