threshold-negator4bit

4-bit bitwise NOT (one's complement negation).

Function

negator4bit(a3, a2, a1, a0) = [NOT(a3), NOT(a2), NOT(a1), NOT(a0)]

Inverts each bit independently.

Truth Table (selected rows)

Input Output
0000 1111
0001 1110
0101 1010
1111 0000

Architecture

Single layer with 4 independent NOT neurons.

Output Weight on input Bias
y3 a3: -1 0
y2 a2: -1 0
y1 a1: -1 0
y0 a0: -1 0

Each neuron fires when its input is 0.

Parameters

Inputs 4
Outputs 4
Neurons 4
Layers 1
Parameters 8
Magnitude 4

Usage

from safetensors.torch import load_file
import torch

w = load_file('model.safetensors')

def negator4(a3, a2, a1, a0):
    inp = torch.tensor([float(a3), float(a2), float(a1), float(a0)])
    return [int((inp * w[f'y{i}.weight']).sum() + w[f'y{i}.bias'] >= 0)
            for i in range(4)]

print(negator4(0, 1, 0, 1))  # [1, 0, 1, 0]

License

MIT

Downloads last month
15
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Collection including phanerozoic/threshold-negator4bit