threshold-mux4

4:1 multiplexer as threshold circuit. Selects one of four data inputs based on 2-bit select signal.

Circuit

d0 ──┐
d1 ──┼──► MUX4 ──► out
d2 ───      β–²
d3 β”€β”€β”˜      β”‚
         s1 s0

Truth Table

s1 s0 out
0 0 d0
0 1 d1
1 0 d2
1 1 d3

Architecture

Layer Neurons Function
1 4 Select gates (one per input)
2 1 OR (combine selections)

Total: 5 neurons, 39 parameters, 2 layers

Each select gate fires only when:

  1. Its data input is 1, AND
  2. The select lines match its index

Usage

from safetensors.torch import load_file
import torch

w = load_file('model.safetensors')

def mux4(d0, d1, d2, d3, s1, s0):
    inp = torch.tensor([float(d0), float(d1), float(d2), float(d3),
                        float(s1), float(s0)])
    l1 = (inp @ w['layer1.weight'].T + w['layer1.bias'] >= 0).float()
    out = (l1 @ w['layer2.weight'].T + w['layer2.bias'] >= 0).float()
    return int(out.item())

Files

threshold-mux4/
β”œβ”€β”€ model.safetensors
β”œβ”€β”€ create_safetensors.py
β”œβ”€β”€ config.json
└── README.md

License

MIT

Downloads last month
10
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Collection including phanerozoic/threshold-mux4