Skip to main content

NNEngine

PyPI version Python Build system Bindings

A high-performance, fully native C++ Neural Network engine exposed to Python via pybind11.

Designed for rapid experimentation without the Python Global Interpreter Lock (GIL) overhead, nn-engine-core executes the entire deep learning training loop (forward pass, validation, loss calculation, backpropagation, and weight updates) strictly in native C++ using Eigen. It utilizes a zero-allocation flat-memory Autograd graph, AVX SIMD vectorization, and dynamically compiled OpenBLAS to achieve massive speedups over mainstream Python frameworks.

Highlights

  • Native Loop Hoisting: The JITCompiler::fit loop executes entirely in C++, eliminating the Python GIL overhead across epochs and batches.
  • CNN & Modern Layer Support: Built-in support for Conv2dLayer (via parallelized im2col), BatchNorm1dLayer, DropoutLayer, and Leaky ReLUs.
  • Zero-Allocation Autograd: Uses arena allocation (Tape) and flat contiguous memory structs to dynamically build computational graphs without heap allocations.
  • Native Schedulers: Includes StepLR learning rate scheduling calculated natively per-epoch.
  • Pure Python Extensibility: Easily define custom Autograd operations (nn.Op) in pure Python. The engine uses PyBind11 trampolines to dispatch the C++ backward pass dynamically to your Python methods.
  • Native Checkpointing: Dump and restore raw contiguous memory weights directly to disk via C++ streams (.nne files) for blazing fast model saving.

Installation

Install the released wheel from PyPI (macOS, Linux, and Windows supported):

pip install nn-engine-core

Or install in editable/development mode from the repository (requires CMake 3.18+ and a C++17 compiler):

pip install -e .

Quick Start: Building a CNN

import numpy as np
import nnengine as nne

X_train = np.random.rand(100, 1, 64, 64).astype(np.float32)
y_train = np.eye(40, dtype=np.float32)[np.random.choice(40, 100)]

class NNEngineDeepCNN(nne.Module):
    def __init__(self, in_h, in_w, num_classes):
        super().__init__()
        self.conv1 = nne.Conv2dLayer(1, 16, in_h, in_w, kernel_size=5, stride=2, pad=2)
        self.act1 = nne.LeakyReLULayer(0.01)
        out_h1, out_w1 = in_h // 2, in_w // 2
        self.conv2 = nne.Conv2dLayer(16, 32, out_h1, out_w1, kernel_size=3, stride=2, pad=1)
        self.act2 = nne.LeakyReLULayer(0.01)
        out_h2, out_w2 = out_h1 // 2, out_w1 // 2
        self.fc = nne.DenseLayer(32 * out_h2 * out_w2, num_classes)

    def forward(self, x):
        x = self.act1(self.conv1(x))
        x = self.act2(self.conv2(x))
        return self.fc(x)

model = NNEngineDeepCNN(64, 64, 40)
optimizer = nne.Adam(learning_rate=0.001)
loss_fn = nne.SoftmaxCrossEntropyLoss()
trainer = nne.JITCompiler(model, optimizer, loss_fn)

dataloader = nne.DataLoader(X_train, y_train, batch_size=32, shuffle=True, drop_last=True)
trainer.fit(dataloader, epochs=40, verbose=False)
trainer.save_checkpoint("faces_model")

Defining Custom Autograd Operations in Python

import numpy as np
import nnengine as nne

class MulOp(nne.Op):
    def __init__(self, a, b):
        super().__init__()
        self.a = a
        self.b = b

    def forward(self):
        self.out_data = self.a.data * self.b.data

    def backward(self):
        if self.a.requires_grad:
            self.a.grad += self.out.grad * self.b.data
        if self.b.requires_grad:
            self.b.grad += self.out.grad * self.a.data

Testing & Validation Suite

Execute the full validation and benchmark suite via:

python examples/script.py

Latest Benchmark Results (Multi-Seed Selection)

Benchmark Task Scikit-Learn PyTorch (ATen) NNEngine (C++ JIT) Speedup
Deep Regression MSE: 0.2811
Time: 9.13s
MSE: 0.2720
Time: 18.49s
MSE: 0.2675
Time: 2.76s
6.70x
Deep CNN N/A Acc: 97.50%
Time: 5.87s
Acc: 97.50%
Time: 4.49s
1.31x

Metadata

Release files for nn-engine-core 0.1.7

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

Source distribution (sdist)

Source distribution for nn-engine-core 0.1.7
File Size Uploaded Provenance
nn_engine_core-0.1.7.tar.gz 40.8 kB With provenance Details

Built distributions (wheels)

Table of built distributions (wheels) for nn-engine-core 0.1.7
File
nn_engine_core-0.1.7-cp314-cp314t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.14 CPython 3.14 free-threading Linux glibc 2.28+ x86-64, Linux glibc 2.27+ x86-64 Details
nn_engine_core-0.1.7-cp314-cp314t-macosx_26_0_arm64.whl CPython 3.14 CPython 3.14 free-threading macOS 26.0+ ARM64 Details
nn_engine_core-0.1.7-cp314-cp314-win_amd64.whl CPython 3.14 CPython 3.14 Windows x86-64 Details
nn_engine_core-0.1.7-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.14 CPython 3.14 Linux glibc 2.28+ x86-64, Linux glibc 2.27+ x86-64 Details
nn_engine_core-0.1.7-cp314-cp314-macosx_26_0_arm64.whl CPython 3.14 CPython 3.14 macOS 26.0+ ARM64 Details
nn_engine_core-0.1.7-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details
nn_engine_core-0.1.7-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.28+ x86-64, Linux glibc 2.27+ x86-64 Details
nn_engine_core-0.1.7-cp313-cp313-macosx_26_0_arm64.whl CPython 3.13 CPython 3.13 macOS 26.0+ ARM64 Details
nn_engine_core-0.1.7-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details
nn_engine_core-0.1.7-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.28+ x86-64, Linux glibc 2.27+ x86-64 Details
nn_engine_core-0.1.7-cp312-cp312-macosx_26_0_arm64.whl CPython 3.12 CPython 3.12 macOS 26.0+ ARM64 Details

Total release size: 9.7 MB

Release files / nn_engine_core-0.1.7.tar.gz

Download URL nn_engine_core-0.1.7.tar.gz
Size 40.8 kB
Tags Source
SHA-256 checksum
How to use checksums
acbf0cd5ca4833440648a82a1e555968fdcdae77291c42c37fdd633f2bf88869
BLAKE2b-256 checksum
How to use checksums
9db487a82962281e797d75c96423f4e580e0b78833ccad3c36dcc1c31aab8e51
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.14

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 Jul 26, 2026.

Transparency log

Release files / nn_engine_core-0.1.7-cp314-cp314t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL nn_engine_core-0.1.7-cp314-cp314t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 1.2 MB
Tags CPython 3.14 CPython 3.14 free-threading Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
dd04d77291c00f651ad1d84ce878d24517891d78f85ec47657ae8dc9fa4309ac
BLAKE2b-256 checksum
How to use checksums
d8468f046b2def04fb00b88344bc113ebd1c7596d91e61eda32cf45f9e310854
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.14

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 Jul 26, 2026.

Transparency log

Release files / nn_engine_core-0.1.7-cp314-cp314t-macosx_26_0_arm64.whl

Download URL nn_engine_core-0.1.7-cp314-cp314t-macosx_26_0_arm64.whl
Size 492.2 kB
Tags CPython 3.14 CPython 3.14 free-threading macOS 26.0+ ARM64
SHA-256 checksum
How to use checksums
fccd524af1eb1524f18982c861ddbb75615aecb895ddcfd1afe7b6d1fd4440c0
BLAKE2b-256 checksum
How to use checksums
19438d7f25169037b9c917d0b6b594925b6b2fce7a903a7ac68f8174a453ae56
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.14

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 Jul 26, 2026.

Transparency log

Release files / nn_engine_core-0.1.7-cp314-cp314-win_amd64.whl

Download URL nn_engine_core-0.1.7-cp314-cp314-win_amd64.whl
Size 1.0 MB
Tags CPython 3.14 Windows x86-64
SHA-256 checksum
How to use checksums
2ae981a4bac9c5045303c76349caea1fbd0d04ccd50c01cb57e88d0707243ef1
BLAKE2b-256 checksum
How to use checksums
4b7aaca237ca0734298c1ab21f10c23fcdc794b97a7eb4dfdd1a58299d2c3f7c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.14

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 Jul 26, 2026.

Transparency log

Release files / nn_engine_core-0.1.7-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL nn_engine_core-0.1.7-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 1.2 MB
Tags CPython 3.14 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
8982a63c5ad4d128d4e42d22bc5fb93ee7a112b3a1095129b3482d1939089fff
BLAKE2b-256 checksum
How to use checksums
56c1e5b699e73c63a867d902c7a3b7780c1ce13ad174b6a184f288850bfb58a5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.14

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 Jul 26, 2026.

Transparency log

Release files / nn_engine_core-0.1.7-cp314-cp314-macosx_26_0_arm64.whl

Download URL nn_engine_core-0.1.7-cp314-cp314-macosx_26_0_arm64.whl
Size 479.0 kB
Tags CPython 3.14 macOS 26.0+ ARM64
SHA-256 checksum
How to use checksums
b4795483f1f24546d7d280e8d77ee160a730386340180b4429508aa7ff6ddfd9
BLAKE2b-256 checksum
How to use checksums
5ca6cdbb467100602f199e6098a3568fb1fc3d753ed806b6ea7c36115d0fea34
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.14

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 Jul 26, 2026.

Transparency log

Release files / nn_engine_core-0.1.7-cp313-cp313-win_amd64.whl

Download URL nn_engine_core-0.1.7-cp313-cp313-win_amd64.whl
Size 979.7 kB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
f839c50086788c9bb06365815219b05cb0cb1a92eb603274650fb6fb6c3a6e1c
BLAKE2b-256 checksum
How to use checksums
6461179362cb614685876a0cc8ebce4d72bf7bd50edb65e7a0f9096e2f4921d9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.14

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 Jul 26, 2026.

Transparency log

Release files / nn_engine_core-0.1.7-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL nn_engine_core-0.1.7-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 1.2 MB
Tags CPython 3.13 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
58c842f718780f0883a15d4389a280257bbf34f99b89914880d93f461f17e6f8
BLAKE2b-256 checksum
How to use checksums
e9d83c754354d9c5b21424557f696fa220a2b46877b51bcb981d234d43b6d3f0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.14

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 Jul 26, 2026.

Transparency log

Release files / nn_engine_core-0.1.7-cp313-cp313-macosx_26_0_arm64.whl

Download URL nn_engine_core-0.1.7-cp313-cp313-macosx_26_0_arm64.whl
Size 477.6 kB
Tags CPython 3.13 macOS 26.0+ ARM64
SHA-256 checksum
How to use checksums
a46a10619c81203d43c41ead7b072760825a80ed136f2e418dc2249138ee4032
BLAKE2b-256 checksum
How to use checksums
681c97788232b21ea6bf4ef714ecfc6f37bd48ece0963167d16bba31525fd65f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.14

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 Jul 26, 2026.

Transparency log

Release files / nn_engine_core-0.1.7-cp312-cp312-win_amd64.whl

Download URL nn_engine_core-0.1.7-cp312-cp312-win_amd64.whl
Size 979.7 kB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
329187d58ba0c02afb48f3c9279430aa6dda83649e190a0a56032dab501e91c2
BLAKE2b-256 checksum
How to use checksums
023a056054429d84d815bfce3b69f86885b5031d4ea084b7520a407f938bf150
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.14

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 Jul 26, 2026.

Transparency log

Release files / nn_engine_core-0.1.7-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL nn_engine_core-0.1.7-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 1.2 MB
Tags CPython 3.12 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
de547e29a25576b12d272137f3585c3dc84af62a57a8e9bd88dff79b6844172a
BLAKE2b-256 checksum
How to use checksums
fbd90c5b1cd08a9bfcf0c9557ab9ba8d1a6fdbb6678996de62099c3681fc20ce
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.14

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 Jul 26, 2026.

Transparency log

Release files / nn_engine_core-0.1.7-cp312-cp312-macosx_26_0_arm64.whl

Download URL nn_engine_core-0.1.7-cp312-cp312-macosx_26_0_arm64.whl
Size 477.5 kB
Tags CPython 3.12 macOS 26.0+ ARM64
SHA-256 checksum
How to use checksums
31be86ae948365d31641776e35f576174579b323bd0e7f39518ea350c11bd0ef
BLAKE2b-256 checksum
How to use checksums
c5ff414b918fb51a3dd42a99b7f734160cccf77e3275be4941573acd461d2b0e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.14

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 Jul 26, 2026.

Transparency log

Security for nn-engine-core 0.1.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.

Full provenance

All 12 files in this release have been uploaded with provenance metadata.

Select from 12 files

Attestation for nn_engine_core-0.1.7.tar.gz

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 Jul 26, 2026.

Transparency log

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.

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