npmlp-core: Modular Deep Learning Framework from Scratch
A lightweight, modular deep learning library built entirely in NumPy. This project implements the core components of modern neural networks, including backpropagation, vectorized optimization, and advanced regularization techniques, without the use of high-level frameworks like PyTorch or TensorFlow.
Installation
pip install npmlp-core
Quick Start
import numpy as np
from mytorch.models import MLP1
from mytorch.optim import SGD
from mytorch.nn import CrossEntropyLoss
# Create a model (input: 784, output: 10 classes)
model = MLP1(784, 10)
# Set up optimizer and loss
optimizer = SGD(model.parameters(), lr=0.01, momentum=0.9)
criterion = CrossEntropyLoss()
# Training step
x = np.random.randn(32, 784) # batch of 32
y = np.random.randint(0, 10, 32) # labels
# Forward pass
output = model.forward(x)
loss = criterion.forward(output, y)
# Backward pass
grad = criterion.backward()
model.backward(grad)
# Update weights
optimizer.step()
optimizer.zero_grad()
Key Features
- Core Layers: Fully functional Linear layers with comprehensive backpropagation.
- Advanced Activations: Implementation of ReLU, Sigmoid, Tanh, and modern industry-standard functions like GELU (Gaussian Error Linear Units) and Swish.
- Regularization: Vectorized BatchNorm1d with training/inference mode logic and running statistics.
- Optimizers: Stochastic Gradient Descent (SGD) with configurable Momentum.
- Loss Functions: MSELoss and CrossEntropyLoss with numerically stable Softmax integration.
- Architectures: Pre-configured Multi-Layer Perceptron (MLP) models ranging from shallow (MLP0) to deep (MLP4) configurations.
Technical Highlights
1. Vectorized Backpropagation
Every layer in this library implements its own forward and backward pass. The gradients are calculated using vectorized matrix calculus, ensuring high performance on the CPU.
2. Numerical Stability
The Softmax and CrossEntropy implementations include numerical stability techniques (such as the max-subtraction method) to prevent floating-point overflow during exponentiation.
3. Training vs. Inference Mode
The BatchNorm1d layer manages global running means and variances using exponential moving averages (momentum), ensuring the models perform accurately during evaluation on single samples.
Project Structure
mlp-core/
├── src/
│ └── mytorch/
│ ├── nn/ # Layers (Linear, BatchNorm) and Activations
│ ├── optim/ # SGD with Momentum
│ ├── models/ # MLP Architectures
│ └── loss.py # MSE and Cross-Entropy
├── requirements.txt # Minimal dependencies (NumPy, SciPy)
└── README.md
Metadata
Release files for npmlp-core 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
Total release size: 6.3 MB
Release files / npmlp_core-1.0.0-cp312-cp312-win_amd64.whl
| Download URL | npmlp_core-1.0.0-cp312-cp312-win_amd64.whl |
|---|---|
| Size | 166.3 kB |
| Tags | CPython 3.12 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
c885a68aaed6cd11c2acd47930e06667178cf9181df310d9d52426234411ecc3
|
|
BLAKE2b-256 checksum How to use checksums |
cbde79e2b58a3bf64702596d61dbbb14535da7cb241d1c00230fd75ba68193e4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jan 29, 2026.
Transparency logRelease files / npmlp_core-1.0.0-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | npmlp_core-1.0.0-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 1.2 MB |
| Tags | CPython 3.12 Linux glibc 2.17+ x86-64 Linux glibc 2.5+ x86-64 |
|
SHA-256 checksum How to use checksums |
f8437cbdeff2c7f54fca58dcd73faa0a37ea1ab9dc686c0fe625674e46105f24
|
|
BLAKE2b-256 checksum How to use checksums |
396830747f6d4e1304a84b8a2ad65be522f31e89adb6a8dddf9c564b44e9f2d8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jan 29, 2026.
Transparency logRelease files / npmlp_core-1.0.0-cp312-cp312-macosx_11_0_arm64.whl
| Download URL | npmlp_core-1.0.0-cp312-cp312-macosx_11_0_arm64.whl |
|---|---|
| Size | 179.1 kB |
| Tags | CPython 3.12 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
1df8be3beadccd7c008ddaaaa79a2b0dc3463afa45c21eb2408356ed5734f48c
|
|
BLAKE2b-256 checksum How to use checksums |
a444ca188174a795162022c9079e1473cf2b5be5bc39aa4e56638170fa7d93e2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jan 29, 2026.
Transparency logRelease files / npmlp_core-1.0.0-cp312-cp312-macosx_10_13_x86_64.whl
| Download URL | npmlp_core-1.0.0-cp312-cp312-macosx_10_13_x86_64.whl |
|---|---|
| Size | 180.1 kB |
| Tags | CPython 3.12 macOS 10.13+ x86-64 |
|
SHA-256 checksum How to use checksums |
250c9b6a1747a0e6d8ed42209e3ceb6549e58e30b7e9bdc6df3ad9b8ac8e350f
|
|
BLAKE2b-256 checksum How to use checksums |
40fc9d1bb6ddbad2d5d43dee027b42b9b421469cc0ea1821d21b0fe9fcfcfa18
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jan 29, 2026.
Transparency logRelease files / npmlp_core-1.0.0-cp311-cp311-win_amd64.whl
| Download URL | npmlp_core-1.0.0-cp311-cp311-win_amd64.whl |
|---|---|
| Size | 167.7 kB |
| Tags | CPython 3.11 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
2bd8417b504a68b4929313d90f2b3f3b4b19b9d6052fd517b27eecf032b179c9
|
|
BLAKE2b-256 checksum How to use checksums |
845585d177a4c990c085d4928af21752572152326fb52b4b15cc50edb828e3d5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jan 29, 2026.
Transparency logRelease files / npmlp_core-1.0.0-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | npmlp_core-1.0.0-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 1.0 MB |
| Tags | CPython 3.11 Linux glibc 2.17+ x86-64 Linux glibc 2.5+ x86-64 |
|
SHA-256 checksum How to use checksums |
28e9dd55055c2a614f2728510e15abe4bb9a82e10efd37f1131d43941209590c
|
|
BLAKE2b-256 checksum How to use checksums |
d056f947bb161c9f24aad34b39cb2f56c786f99377d6f6ede8fc772ec99ac6ab
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jan 29, 2026.
Transparency logRelease files / npmlp_core-1.0.0-cp311-cp311-macosx_11_0_arm64.whl
| Download URL | npmlp_core-1.0.0-cp311-cp311-macosx_11_0_arm64.whl |
|---|---|
| Size | 177.7 kB |
| Tags | CPython 3.11 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
bfd061c2443048658ce836679601ab2b9abbc0c563c9026b75258cd2b6e7841e
|
|
BLAKE2b-256 checksum How to use checksums |
622d6b251f70810a16b11cd3cec18ad63ec15cdc97fcae43b668050b56d17848
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jan 29, 2026.
Transparency logRelease files / npmlp_core-1.0.0-cp311-cp311-macosx_10_9_x86_64.whl
| Download URL | npmlp_core-1.0.0-cp311-cp311-macosx_10_9_x86_64.whl |
|---|---|
| Size | 178.8 kB |
| Tags | CPython 3.11 macOS 10.9+ x86-64 |
|
SHA-256 checksum How to use checksums |
35fc2d8918eb2787da2ada7bf249a80cf701bfdd7577cf26151391ad6d9f5cb9
|
|
BLAKE2b-256 checksum How to use checksums |
180b94302a18c4216cd969e0b528ea93a3c9ce5df69129de612c68a478898692
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jan 29, 2026.
Transparency logRelease files / npmlp_core-1.0.0-cp310-cp310-win_amd64.whl
| Download URL | npmlp_core-1.0.0-cp310-cp310-win_amd64.whl |
|---|---|
| Size | 167.8 kB |
| Tags | CPython 3.10 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
79a646c6d0e7e70543f911d2beaec06059864c525febe69d2023a055c57d34a9
|
|
BLAKE2b-256 checksum How to use checksums |
ab84e03dd87ad47e7f0f480b1e97aac5a9004f6b9f864ac9867630f4639e36f6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jan 29, 2026.
Transparency logRelease files / npmlp_core-1.0.0-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | npmlp_core-1.0.0-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 998.0 kB |
| Tags | CPython 3.10 Linux glibc 2.17+ x86-64 Linux glibc 2.5+ x86-64 |
|
SHA-256 checksum How to use checksums |
450673a2e597e1f47f0195e7dd57019e235faf235494d20fa2d63afc140dc0b6
|
|
BLAKE2b-256 checksum How to use checksums |
1f5beb752dffa48e26e8e7953ef382ac5100f495a70e6802a774a80486fa4eb3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jan 29, 2026.
Transparency logRelease files / npmlp_core-1.0.0-cp310-cp310-macosx_11_0_arm64.whl
| Download URL | npmlp_core-1.0.0-cp310-cp310-macosx_11_0_arm64.whl |
|---|---|
| Size | 179.0 kB |
| Tags | CPython 3.10 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
245ed89fb5135d78369d4631c0af3c13ba089c59dbb02504efde9e28b125550c
|
|
BLAKE2b-256 checksum How to use checksums |
fec69e66c2c06346599f25b7b126d1b9dbdbc0a0b41729d3fcc1fba38c1e772e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jan 29, 2026.
Transparency logRelease files / npmlp_core-1.0.0-cp310-cp310-macosx_10_9_x86_64.whl
| Download URL | npmlp_core-1.0.0-cp310-cp310-macosx_10_9_x86_64.whl |
|---|---|
| Size | 180.6 kB |
| Tags | CPython 3.10 macOS 10.9+ x86-64 |
|
SHA-256 checksum How to use checksums |
e6bcd841ccddae47e076bb30b74ea0996a469a194a1a0871b58255a79857889d
|
|
BLAKE2b-256 checksum How to use checksums |
c30d99014842db4c139eca7f4c46ef5e816665e2bd2989ffa0c87d070fb0c4ab
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jan 29, 2026.
Transparency logRelease files / npmlp_core-1.0.0-cp39-cp39-win_amd64.whl
| Download URL | npmlp_core-1.0.0-cp39-cp39-win_amd64.whl |
|---|---|
| Size | 168.4 kB |
| Tags | CPython 3.9 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
7a0285a86f688cd9c7fc1d303b3b8546d79f20ad0b413f2aa70ea330f3e3413e
|
|
BLAKE2b-256 checksum How to use checksums |
8948e6962e2a415aa123d5176075d2cb0333dbbd55c91d82ed809ec1496818f3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jan 29, 2026.
Transparency logRelease files / npmlp_core-1.0.0-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | npmlp_core-1.0.0-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 990.2 kB |
| Tags | CPython 3.9 Linux glibc 2.17+ x86-64 Linux glibc 2.5+ x86-64 |
|
SHA-256 checksum How to use checksums |
9acc0e44c0b0470f2b4c0aabe748237eabb09e766ad7582ebcc945b31dba782f
|
|
BLAKE2b-256 checksum How to use checksums |
9c034d4b9ce95ff9a698e48ea4a9e356adc9c666caeeec7ea0ce032bf31b5fc5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jan 29, 2026.
Transparency logRelease files / npmlp_core-1.0.0-cp39-cp39-macosx_11_0_arm64.whl
| Download URL | npmlp_core-1.0.0-cp39-cp39-macosx_11_0_arm64.whl |
|---|---|
| Size | 179.8 kB |
| Tags | CPython 3.9 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
30d4c1fa7c2d811928532bb057f8f033e89453249035a81b954cdbcaa10d42ea
|
|
BLAKE2b-256 checksum How to use checksums |
d3107e424cd36100808af9edca0f83b1e4d0f838342c69da7f0f72e9d3287289
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jan 29, 2026.
Transparency logRelease files / npmlp_core-1.0.0-cp39-cp39-macosx_10_9_x86_64.whl
| Download URL | npmlp_core-1.0.0-cp39-cp39-macosx_10_9_x86_64.whl |
|---|---|
| Size | 181.4 kB |
| Tags | CPython 3.9 macOS 10.9+ x86-64 |
|
SHA-256 checksum How to use checksums |
1581be1fd408b5b81c6a2ce304334e2a6ef0334d21882c221f56dbdfe7f855aa
|
|
BLAKE2b-256 checksum How to use checksums |
dd9763112eb53370639832e7e1584277a303b1184233c539c9bbc76771bf408e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jan 29, 2026.
Transparency log