1:4 demultiplexer. Routes data input to one of 4 outputs based on 2-bit select.
Single layer with 4 neurons. Each output yi fires when d=1 AND select matches i.
1from safetensors.torch import load_file
2import torch
3
4w = load_file('model.safetensors')
5
6def demux4(d, s1, s0):
7 inp = torch.tensor([float(d), float(s1), float(s0)])
8 return [int((inp * w[f'y{i}.weight']).sum() + w[f'y{i}.bias'] >= 0)
9 for i in range(4)]
10
11# Route d=1 to output 2 (s=10)
12print(demux4(1, 1, 0)) # [0, 0, 1, 0]