Noni (WIP)
A minimal tensor library with autograd flexible for building good enough deep learning models.
Familiar API
a = Tensor([[1., 2.], [3., 4.]], requires_grad=True)
b = Tensor([[0.5, -1.], [2., 0.]], requires_grad=True)
# Each op records its backward function
c = a * b # op="*", backward: dc/da = b, dc/db = a
d = c.sum() # op="sum", backward: ones
d.backward() # topological sort → apply each _backward in reverse
print(a.grad) # dL/da = b.data = [[0.5, -1.], [2., 0.]]
print(b.grad) # dL/db = a.data = [[1., 2.], [3., 4.]]
Common Modules for everything
from noni.nn import Linear, LayerNorm, MultiHeadAttention, CrossEntropyLoss
# A simple 2-layer MLP
W1 = Linear(784, 256)
W2 = Linear(256, 10)
x = Tensor(some_batch)
h = W1(x).relu()
logits = W2(h)
loss = CrossEntropyLoss()(logits, targets)
loss.backward() # gradients in W1.weight.grad, W2.weight.grad etc.
Build your own
Noni has three built-in backends:
| Backend | Device tag | Notes |
|---|---|---|
| NumPy | cpu |
Always available, pure Python/NumPy |
| OpenCL | opencl |
Cross-platform GPU (NVIDIA, AMD, Intel) |
| MLX | mlx |
Apple Silicon GPU via Metal — recommended for M-series Macs |
Move tensors and modules to any backend with .to():
from noni import Tensor
from noni.nn import Linear
# Apple Silicon — runs matmul through Metal Performance Shaders
lin = Linear(512, 256)
lin.to("mlx")
x = Tensor(data, device="mlx")
y = lin(x)
There is also work going on to support CUDA natively as well as Vulkan compute and Triton. You can always implement and register your own backend if you prefer.
from noni.backends import Backend, register_backend
class MyDevice(Backend):
...
register_backend("mygpu", MyDevice())
| Module | Description |
|---|---|
| Linear | Fully connected layer with weight + bias parameters, initialized using Kaiming initialization |
| Embedding | Lookup table for token embeddings with scatter-add backward pass |
| LayerNorm | Normalizes across the last N dimensions with learned affine parameters |
| Dropout | Inverted dropout applied during training for regularization |
| MultiHeadAttention | Multi-head self-attention module with optional causal mask for autoregressive models |
| FeedForward | Position-wise feedforward network using GELU activation |
| TransformerBlock | Pre-norm residual block combining Multi-Head Attention and FeedForward layers |
| CrossEntropyLoss | Numerically stable implementation using log-softmax + negative log likelihood |
| Optimizers | Includes SGD, Adam, AdamW, and CosineAnnealingLR scheduler |
Building wheels
python -m build
twine upload dist/*
Metadata
Release files for noniml 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| noniml-0.1.2.tar.gz | 34.7 kB | Without provenance | Details for noniml-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| noniml-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for noniml-0.1.2-py3-none-any.whl |
Total release size: 65.0 kB
Release files / noniml-0.1.2.tar.gz
| Download URL | noniml-0.1.2.tar.gz |
|---|---|
| Size | 34.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
de2b445968ae9290a59e9624641032b59a48c27a143f0335f848156a52b008ac
|
|
BLAKE2b-256 checksum How to use checksums |
c47de710724275946b639c91dc7bb9e2e50a27ada8f2673efe7f99c4ceb2973f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.9
|
Release files / noniml-0.1.2-py3-none-any.whl
| Download URL | noniml-0.1.2-py3-none-any.whl |
|---|---|
| Size | 30.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5e3198241fb7159db568ef3ae42d2f4ce3c8f404407e9596431cf5bddc4ffe0b
|
|
BLAKE2b-256 checksum How to use checksums |
3aaf1f271b5462ddb3eaf8028074d4dceec79c147010de9c6135b3d29696f900
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.9
|
Security for noniml 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.