|
Download README.md from phanerozoic/threshold-1outof8: direct link, hf CLI and curl.
- Browser
- Download file 1.69 kB
-
https://huggingface.co/phanerozoic/threshold-1outof8/resolve/main/README.md
- Command line
-
hf download hf://phanerozoic/threshold-1outof8/README.md
-
curl -L -o README.md https://huggingface.co/phanerozoic/threshold-1outof8/resolve/main/README.md
1.69 kB
metadata
license: mit
tags:
- pytorch
- safetensors
- threshold-logic
- neuromorphic
threshold-1outof8
At-least-one detector for 8 inputs. Equivalent to an 8-input OR gate.
Circuit
xβ xβ xβ xβ xβ xβ
xβ xβ
β β β β β β β β
ββββ΄βββ΄βββ΄βββΌβββ΄βββ΄βββ΄βββ
βΌ
βββββββββββ
β w: all 1β
β b: -1 β
βββββββββββ
β
βΌ
HW β₯ 1
Mechanism
With uniform weights of 1 and bias -1, the neuron fires when at least one input is active:
- Sum = (number of 1s) - 1
- Fires when sum β₯ 0, i.e., when Hamming weight β₯ 1
This is the loosest threshold in the k-out-of-8 family.
k-out-of-8 Family
| Circuit | Bias | Fires when |
|---|---|---|
| 1-out-of-8 | -1 | HW β₯ 1 (this) |
| 2-out-of-8 | -2 | HW β₯ 2 |
| ... | ... | ... |
| 8-out-of-8 | -8 | HW = 8 |
All share weights [1,1,1,1,1,1,1,1]. Only the bias differs.
Parameters
| Weights | [1, 1, 1, 1, 1, 1, 1, 1] |
| Bias | -1 |
| Total | 9 parameters |
Usage
from safetensors.torch import load_file
import torch
w = load_file('model.safetensors')
def at_least_1(bits):
inputs = torch.tensor([float(b) for b in bits])
return int((inputs * w['weight']).sum() + w['bias'] >= 0)
Files
threshold-1outof8/
βββ model.safetensors
βββ model.py
βββ config.json
βββ README.md
License
MIT