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.6

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.6
File Size Uploaded Provenance
nn_engine_core-0.1.6.tar.gz 39.4 kB With provenance Details

Built distributions (wheels)

Table of built distributions (wheels) for nn-engine-core 0.1.6
File
nn_engine_core-0.1.6-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.6-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.6-cp314-cp314-win_amd64.whl CPython 3.14 CPython 3.14 Windows x86-64 Details
nn_engine_core-0.1.6-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.6-cp314-cp314-macosx_26_0_arm64.whl CPython 3.14 CPython 3.14 macOS 26.0+ ARM64 Details
nn_engine_core-0.1.6-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details
nn_engine_core-0.1.6-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.6-cp313-cp313-macosx_26_0_arm64.whl CPython 3.13 CPython 3.13 macOS 26.0+ ARM64 Details
nn_engine_core-0.1.6-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details
nn_engine_core-0.1.6-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.27+ x86-64, Linux glibc 2.28+ x86-64 Details
nn_engine_core-0.1.6-cp312-cp312-macosx_26_0_arm64.whl CPython 3.12 CPython 3.12 macOS 26.0+ ARM64 Details

Total release size: 5.5 MB

Release files / nn_engine_core-0.1.6.tar.gz

Download URL nn_engine_core-0.1.6.tar.gz
Size 39.4 kB
Tags Source
SHA-256 checksum
How to use checksums
402282bf99461d4232f624aeb0f528374cf5eaee23cf103bfa1709ae6179a6ba
BLAKE2b-256 checksum
How to use checksums
d481b86fe5b99ffb46764fb08e0e5a9f9ad009c1724c7d35578eff642881fc4f
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.6-cp314-cp314t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL nn_engine_core-0.1.6-cp314-cp314t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 479.0 kB
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
d2b789803ff9b610c0137766266de055f0e1e71b080ae5df95ec55b71a4e7c31
BLAKE2b-256 checksum
How to use checksums
4d365a30b68ddee9772eb2c7a699675c9145cfac29035fe49081bd27902842c3
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.6-cp314-cp314t-macosx_26_0_arm64.whl

Download URL nn_engine_core-0.1.6-cp314-cp314t-macosx_26_0_arm64.whl
Size 488.4 kB
Tags CPython 3.14 CPython 3.14 free-threading macOS 26.0+ ARM64
SHA-256 checksum
How to use checksums
2937b380e869fc1e699444c19c08e19afbd5908ff4ca884d8fddbd730e69b0e4
BLAKE2b-256 checksum
How to use checksums
d39d8af1cee9cc93d0c2f9d1f5c862d9303bbc57681c720584088f8cc5959d83
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.6-cp314-cp314-win_amd64.whl

Download URL nn_engine_core-0.1.6-cp314-cp314-win_amd64.whl
Size 545.0 kB
Tags CPython 3.14 Windows x86-64
SHA-256 checksum
How to use checksums
fcb0dee0225479b397fcc3977d176de8c9c800820f2e210a4fa434aba44be408
BLAKE2b-256 checksum
How to use checksums
5474140c6a3cc7c88434f67a36ab646091d1784216c6cabe2ec2b62e0953d1f0
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.6-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL nn_engine_core-0.1.6-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 483.7 kB
Tags CPython 3.14 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
b952467837bef1ea11fa748a611858058729688fa98144897923e341e70fad80
BLAKE2b-256 checksum
How to use checksums
d05db314255544ccbb08e11edd083d0e5e4594f52421a78b902d81798b04a4ad
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.6-cp314-cp314-macosx_26_0_arm64.whl

Download URL nn_engine_core-0.1.6-cp314-cp314-macosx_26_0_arm64.whl
Size 475.2 kB
Tags CPython 3.14 macOS 26.0+ ARM64
SHA-256 checksum
How to use checksums
e9a7545d541d885f75523902e2995802a64e9f80d0d89cbd2b8f00d2243dd30d
BLAKE2b-256 checksum
How to use checksums
a7dca417cb50753ba0138f2be0441dc94b73e806b7bb133a585e028fbe979d42
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.6-cp313-cp313-win_amd64.whl

Download URL nn_engine_core-0.1.6-cp313-cp313-win_amd64.whl
Size 527.5 kB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
a113b8fb7a95070b7a11b9a945b6b697031be6bca76cb962442b715efe3f47e2
BLAKE2b-256 checksum
How to use checksums
d3ef01b17af056a28f199c4b99918c14f5a4d99d1ad4bd8efa38301ee1a20ca9
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.6-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL nn_engine_core-0.1.6-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 483.3 kB
Tags CPython 3.13 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
08548dba1cb00a822f97261d5cdd10b9dead3b31acd3c9ff4b6fbd625ab78909
BLAKE2b-256 checksum
How to use checksums
9c35bd7104ff3002fc8b8c14d0c6a04f755cb64ad41f83cd752e978d7f4eba98
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.6-cp313-cp313-macosx_26_0_arm64.whl

Download URL nn_engine_core-0.1.6-cp313-cp313-macosx_26_0_arm64.whl
Size 473.8 kB
Tags CPython 3.13 macOS 26.0+ ARM64
SHA-256 checksum
How to use checksums
284f9b3be5084e2ff0312a6d830c06794393ecd118b02f8514418deb32e806e1
BLAKE2b-256 checksum
How to use checksums
04ff226adff738ec9c56c8d88e82db3f75f05dd9ebee84a8bc90925c53fb1263
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.6-cp312-cp312-win_amd64.whl

Download URL nn_engine_core-0.1.6-cp312-cp312-win_amd64.whl
Size 527.6 kB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
0f98af660c24f2036ef84fc467d71e17b5d0b057245cdc048c3e4e4c691b3587
BLAKE2b-256 checksum
How to use checksums
139d9624020023042f87d3afad50d7e1f2f46720f68aaed79d15170e25c753f4
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.6-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL nn_engine_core-0.1.6-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 483.2 kB
Tags CPython 3.12 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
bbe5ac151a568dfc92c12f091055b460787e89a7d6032f28afb10d8b8fe77313
BLAKE2b-256 checksum
How to use checksums
245ee441a25cdfc33632528211fa6edb1740abee45f0e4bcfad8a523c974414e
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.6-cp312-cp312-macosx_26_0_arm64.whl

Download URL nn_engine_core-0.1.6-cp312-cp312-macosx_26_0_arm64.whl
Size 473.7 kB
Tags CPython 3.12 macOS 26.0+ ARM64
SHA-256 checksum
How to use checksums
df2cba1db2ab34d55fb0a8c2d39554a4101628bbf06f8d1a5ad820f46e6450da
BLAKE2b-256 checksum
How to use checksums
eb7819190772afe9711d8e15cda8ebf2298dd2e12bd1768e72f279a098649ea0
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.6

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.6.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