Views
No views yet
| i3 | i2 | i1 | i0 | y1 | y0 | v | highest |
|---|---|---|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 0 | 0 | 0 | none |
| 0 | 0 | 0 | 1 | 0 | 0 | 1 | i0 |
| 0 | 0 | 1 | X | 0 | 1 | 1 | i1 |
| 0 | 1 | X | X | 1 | 0 | 1 | i2 |
| 1 | X | X | X | 1 | 1 | 1 | i3 |
| Inputs | 4 |
| Outputs | 3 |
| Neurons | 3 |
| Layers | 1 |
| Parameters | 15 |
| Magnitude | 13 |
1from safetensors.torch import load_file
2import torch
3
4w = load_file('model.safetensors')
5
6def priority_encode(i3, i2, i1, i0):
7 inp = torch.tensor([float(i3), float(i2), float(i1), float(i0)])
8 y1 = int((inp @ w['y1.weight'].T + w['y1.bias'] >= 0).item())
9 y0 = int((inp @ w['y0.weight'].T + w['y0.bias'] >= 0).item())
10 v = int((inp @ w['v.weight'].T + w['v.bias'] >= 0).item())
11 return y1, y0, v
12
13print(priority_encode(0, 1, 1, 0)) # (1, 0, 1) -> i2 is highest
14print(priority_encode(1, 1, 1, 1)) # (1, 1, 1) -> i3 is highest