Views
No views yet
| A1 | A0 | Y0 | Y1 | Y2 | Y3 |
|---|---|---|---|---|---|
| 0 | 0 | 1 | 0 | 0 | 0 |
| 0 | 1 | 0 | 1 | 0 | 0 |
| 1 | 0 | 0 | 0 | 1 | 0 |
| 1 | 1 | 0 | 0 | 0 | 1 |
| Output | Weights [A1, A0] | Bias |
|---|---|---|
| Y0 | [-1, -1] | 0 |
| Y1 | [-1, +1] | -1 |
| Y2 | [+1, -1] | -1 |
| Y3 | [+1, +1] | -2 |
| Inputs | 2 |
| Outputs | 4 |
| Neurons | 4 |
| Layers | 1 |
| Parameters | 12 |
| Magnitude | 12 |
1from safetensors.torch import load_file
2import torch
3
4w = load_file('model.safetensors')
5
6def decode2to4(a1, a0):
7 inp = torch.tensor([float(a1), float(a0)])
8 return [int((inp * w[f'y{i}.weight']).sum() + w[f'y{i}.bias'] >= 0) for i in range(4)]
9
10print(decode2to4(1, 0)) # [0, 0, 1, 0] - input 2