| import torch | |
| from safetensors.torch import load_file | |
| def load_model(path='model.safetensors'): | |
| return load_file(path) | |
| def lte(a, b, weights): | |
| inp = torch.tensor([float(a), float(b)]) | |
| return int((inp @ weights['neuron.weight'].T + weights['neuron.bias'] >= 0).item()) | |
| if __name__ == '__main__': | |
| w = load_model() | |
| print('lessthanorequal truth table:') | |
| for a in [0, 1]: | |
| for b in [0, 1]: | |
| print(f' {a} <= {b} -> {lte(a, b, w)}') | |