Views
No views yet
x y
│ │
└─┬─┘
▼
┌───────┐
│ w: 1,1│
│ b: -2 │
└───────┘
│
▼
AND(x,y)| x | y | sum | output |
|---|---|---|---|
| 0 | 0 | -2 | 0 |
| 0 | 1 | -1 | 0 |
| 1 | 0 | -1 | 0 |
| 1 | 1 | 0 | 1 |
| Weights | [1, 1] |
| Bias | -2 |
| Total | 3 parameters |
1from safetensors.torch import load_file
2import torch
3
4w = load_file('model.safetensors')
5
6def and_gate(x, y):
7 inputs = torch.tensor([float(x), float(y)])
8 return int((inputs * w['weight']).sum() + w['bias'] >= 0)threshold-and/
├── model.safetensors
├── model.py
├── config.json
└── README.md