Downloads · 30 days
9
27% of all-time downloads
phanerozoic/threshold-incrementer4bit
threshold-incrementer4bit is a machine learning model from phanerozoic. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as mit.
4-bit incrementer. Adds 1 to input (modulo 16).
Downloads · 30 days
9
27% of all-time downloads
All-time downloads
33
Public
Parameters
66
Likes
0
Public
Click a slice to open those files.
.py6.2 KB · 67%
From the Hugging Face model README
4-bit incrementer. Adds 1 to input (modulo 16).
incrementer4bit(a3, a2, a1, a0) = (input + 1) mod 16
| Input | Decimal | Output | Decimal |
|---|---|---|---|
| 0000 | 0 | 0001 | 1 |
| 0001 | 1 | 0010 | 2 |
| 0111 | 7 | 1000 | 8 |
| 1111 | 15 | 0000 | 0 |
y0 = NOT(a0)
y1 = a1 XOR a0
y2 = a2 XOR (a1 AND a0)
y3 = a3 XOR (a2 AND a1 AND a0)
Layer 1: Compute NOT(a0), carries (c2, c3), and XOR components for y1 Layer 2: Compute y1, XOR components for y2 and y3 Layer 3: Final AND gates for y2 and y3
| Inputs | 4 |
| Outputs | 4 |
| Neurons | 12 |
| Layers | 3 |
| Parameters | 52 |
| Magnitude | 41 |
from safetensors.torch import load_file
# See model.py for full implementation
# 7 + 1 = 8
# incrementer4(0, 1, 1, 1) = [1, 0, 0, 0]
MIT