threshold-greaterthanorequal

1-bit greater-than-or-equal comparator. Outputs 1 when a >= b.

Function

gte(a, b) = 1 if a >= b, else 0

Equivalent to: a OR NOT(b) (reverse implication)

Truth Table

a b a >= b
0 0 1
0 1 0
1 0 1
1 1 1

Architecture

Single neuron: weights [1, -1], bias 0

Fires when: a - b >= 0, i.e., a >= b

Parameters

Inputs 2
Outputs 1
Neurons 1
Layers 1
Parameters 3
Magnitude 2

Usage

from safetensors.torch import load_file
import torch

w = load_file('model.safetensors')

def gte(a, b):
    inp = torch.tensor([float(a), float(b)])
    return int((inp @ w['neuron.weight'].T + w['neuron.bias'] >= 0).item())

print(gte(1, 0))  # 1
print(gte(0, 1))  # 0

License

MIT

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

Collection including phanerozoic/threshold-greaterthanorequal