Views
No views yet
| Input | Output |
|---|---|
| 0000 | 1111 |
| 0001 | 1110 |
| 0101 | 1010 |
| 1111 | 0000 |
| Output | Weight on input | Bias |
|---|---|---|
| y3 | a3: -1 | 0 |
| y2 | a2: -1 | 0 |
| y1 | a1: -1 | 0 |
| y0 | a0: -1 | 0 |
| Inputs | 4 |
| Outputs | 4 |
| Neurons | 4 |
| Layers | 1 |
| Parameters | 8 |
| Magnitude | 4 |
1from safetensors.torch import load_file
2import torch
3
4w = load_file('model.safetensors')
5
6def negator4(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']).sum() + w[f'y{i}.bias'] >= 0)
9 for i in range(4)]
10
11print(negator4(0, 1, 0, 1)) # [1, 0, 1, 0]