Views
No views yet
| Input | Output |
|---|---|
| 0000 | 0000 |
| 0001 | 0001 |
| ... | ... |
| 1111 | 1111 |
x3 x2 x1 x0
│ │ │ │
▼ ▼ ▼ ▼
○ ○ ○ ○ Layer 1
│ │ │ │
▼ ▼ ▼ ▼
y3 y2 y1 y0| Inputs | 4 |
| Outputs | 4 |
| Neurons | 4 |
| Layers | 1 |
| Parameters | 20 |
| Magnitude | 8 |
1from safetensors.torch import load_file
2import torch
3
4w = load_file('model.safetensors')
5
6def buffer(x3, x2, x1, x0):
7 inp = torch.tensor([float(x3), float(x2), float(x1), float(x0)])
8 y0 = int((inp @ w['y0.weight'].T + w['y0.bias'] >= 0).item())
9 y1 = int((inp @ w['y1.weight'].T + w['y1.bias'] >= 0).item())
10 y2 = int((inp @ w['y2.weight'].T + w['y2.bias'] >= 0).item())
11 y3 = int((inp @ w['y3.weight'].T + w['y3.bias'] >= 0).item())
12 return y3, y2, y1, y0