Multiplication-free lookup neural models with scalar, multi-input, HDC, and additive APIs
Project description
AdderNet 1.6 development fork
This directory contains an audited and extended version of the addernet 1.5.0
package. It keeps the original scalar, HDC, attention, boosting, clustering, and
additive APIs while adding safer native bindings and genuine multi-input models.
Main additions
AdderNetLayer.fit(...): direct O(n + range) scalar LUT fitting.AdderNetLayer.partial_fit(...): blended streaming updates.- Explicit
close()and context-manager lifecycle. - Atomic native saves and portable versioned
.npzsaves. - Hardened native file loading and full validation of C arguments.
AdderNetMultiInputLayer: N inputs, one or more outputs, additive and pairwise LUTs.AdderNetRegressor: alias for the multi-input regression model.AdderNetClassifier: classification wrapper with arbitrary class labels.- Improved
UniformQuantizerwith feature-shape validation and inverse transform. - OpenMP changed to opt-in because it slowed the memory-bound scalar lookup on the test host.
Two-input example
import numpy as np
from addernet import AdderNetMultiInputLayer
x = np.arange(32)
y = np.arange(32)
xx, yy = np.meshgrid(x, y, indexing="ij")
X = np.column_stack([xx.ravel(), yy.ravel()])
target = (xx * yy).ravel()
model = AdderNetMultiInputLayer(bins=32, interactions="auto")
model.fit(X, target)
print(model.predict(7, 9)) # approximately 63
print(model.predict_batch([[2, 3], [4, 5]]))
Build and test
python -m pip install -e .
addernet-selftest
python -m pytest
Set ADDERNET_OPENMP=1 before building only after benchmarking on the target
hardware. The default single-threaded native loop is often faster for this LUT.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
addernet-1.6.0.tar.gz
(107.8 kB
view details)
File details
Details for the file addernet-1.6.0.tar.gz.
File metadata
- Download URL: addernet-1.6.0.tar.gz
- Upload date:
- Size: 107.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
72c886aa8fd3605be94050d449f34f39d000b1d3a4a90edee084ae9d20e090a9
|
|
| MD5 |
05dbfcfa70d4efaaff7e365b977a979e
|
|
| BLAKE2b-256 |
630ab107207c8d09be66fea8dac3e37ddae10b84f91c9a4de449ff37f2cd316e
|