Skip to main content

Banner

NNRT: Neural Network Runtime

NNRT is a lightweight deep learning framework built from scratch in Python.
It is designed to replicate core concepts of modern frameworks like PyTorch, including tensors, autograd, neural networks, and optimizers.

Features

NNRT provides core deep learning components including:

Tensor Core

  • Multi dimensional Tensor support
  • Autograd (automatic differentiation)
  • Basic math operations
  • CPU (and optional CUDA support via nnrt.cuda)

Neural Network Layers

  • Linear (Fully Connected)
  • Conv2D
  • MaxPool2D
  • BatchNorm1d
  • LayerNorm
  • Embedding

Activation Functions

  • ReLU
  • LeakyReLU
  • Sigmoid
  • Tanh
  • GELU
  • Softmax
  • LogSoftmax

Model Building

  • Sequential API
  • Module / Parameter system
  • ModuleList support
  • Dropout
  • Flatten layer

Loss Functions

  • MSELoss
  • CrossEntropyLoss
  • NLLLoss
  • BCELoss
  • BCEWithLogitsLoss

Optimizers

  • SGD
  • Adam
  • RMSProp

Learning Rate Schedulers

  • StepLR
  • ExponentialLR
  • CosineAnnealingLR

Utilities

  • Model save / load
  • No-grad context manager

Installation

CPU version

pip install nnrt

CUDA Versions

CUDA11.x

pip install nnrt[cuda11x]

CUDA12.x

pip install nnrt[cuda12x]

Quick Example

import nnrt as nn

model = nn.Sequential(
    nn.Linear(784, 256),
    nn.ReLU(),
    nn.Linear(256, 10)
)

loss_fn = nn.CrossEntropyLoss()
optimizer = nn.Adam(model.parameters(), lr=0.001)

x = nn.randn(32, 784)
y = nn.randint(0, 10, (32,))

out = model(x)
loss = loss_fn(out, y)

loss.backward()
optimizer.step()
optimizer.zero_grad()

Goal

NNRT is built for:

  • Learning how deep learning frameworks work internally
  • Understanding autograd systems
  • Experimenting with custom neural network architectures

Disclaimer

This is an educational framework and not optimized for production-scale workloads.

If you find NNRT useful, consider giving it a star on GitHub!

Metadata

Release files for nnrt 26.5.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nnrt 26.5.1
File Size Uploaded Provenance
nnrt-26.5.1.tar.gz 24.3 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for nnrt 26.5.1
File Interpreter ABI Platform
nnrt-26.5.1-py3-none-any.whl Python 3 none any Details

Total release size: 56.3 kB

Release files / nnrt-26.5.1.tar.gz

Download URL nnrt-26.5.1.tar.gz
Size 24.3 kB
Tags Source
SHA-256 checksum
How to use checksums
db4b8e000aadfd215161e27a2f0b426d0241e54d5b4a11d64014b1da9f7dc12c
BLAKE2b-256 checksum
How to use checksums
7c3e36cdc14be470b713f0b55700733ce2f56fac5735bfeabf078e145b9bdb41
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.10

Release files / nnrt-26.5.1-py3-none-any.whl

Download URL nnrt-26.5.1-py3-none-any.whl
Size 32.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f403f098b99fbf55e85e71bc4b59e69ecbdfba36b90d06953a03546c0d6ac132
BLAKE2b-256 checksum
How to use checksums
0b03c9dc3780b65601cc36592c8efe4cf30c3b0d36837826280d4a5f3c862c58
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.10

Security for nnrt 26.5.1

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.

Release history Release notifications | RSS feed

This release

26.5.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page