Skip to main content

AffineFlow-NN

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, AffineFlow-NN executes the entire deep learning training loop 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

  • Dual Execution Modes: Train dynamic graphs using the @nn.eager decorator for zero-allocation step-by-step execution, or compile static graphs with JITCompiler for maximum throughput.
  • Dynamic Hardware Dispatch: Automatically detects your CPU at runtime to dispatch highly optimized AVX2 or AVX-512 instructions.
  • CNN & Modern Layer Support: Built-in support for Conv2dLayer, MaxPool2dLayer, AvgPool2dLayer, FlattenLayer, 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.

Installation

Install the released wheel from PyPI:

pip install AffineFlow-NN

Quick Start: Building a CNN

import numpy as np
import affineflow_nn as nn

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 AffineFlowNNDeepCNN(nn.Module):
    def __init__(self, in_h, in_w, num_classes):
        super().__init__()
        self.conv1 = nn.Conv2dLayer(1, 16, in_h, in_w, kernel_size=5, stride=1, pad=2)
        self.act1 = nn.LeakyReLULayer(0.01)
        self.pool1 = nn.MaxPool2dLayer(16, in_h, in_w, kernel_size=2, stride=2, pad=0)
        
        out_h1, out_w1 = in_h // 2, in_w // 2
        self.conv2 = nn.Conv2dLayer(16, 32, out_h1, out_w1, kernel_size=3, stride=1, pad=1)
        self.act2 = nn.LeakyReLULayer(0.01)
        self.pool2 = nn.MaxPool2dLayer(32, out_h1, out_w1, kernel_size=2, stride=2, pad=0)
        
        out_h2, out_w2 = out_h1 // 2, out_w1 // 2
        self.flatten = nn.FlattenLayer()
        self.fc = nn.DenseLayer(32 * out_h2 * out_w2, num_classes)

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

model = AffineFlowNNDeepCNN(64, 64, 40)
optimizer = nn.Adam(learning_rate=0.001)
optimizer.set_parameters(model.parameters())
loss_fn = nn.SoftmaxCrossEntropyLoss()

trainer = nn.JITCompiler(model, optimizer, loss_fn)
dataloader = nn.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")

Latest Benchmark Results

Benchmark Task Scikit-Learn PyTorch (ATen) AffineFlow-NN (Eager) AffineFlow-NN (C++ JIT) Max Speedup (vs PyTorch)
Deep Regression (Housing) MSE: 0.2811
Time: 4.94s
MSE: 0.2720
Time: 13.32s
MSE: 0.2662
Time: 2.47s
MSE: 0.2669
Time: 4.02s
5.39x
Deep CNN (Faces) N/A Acc: 98.75%
Time: 15.19s
Acc: 98.75%
Time: 12.17s
Acc: 98.75%
Time: 11.22s
1.35x

Metadata

Release files for AffineFlow-NN 0.1.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 AffineFlow-NN 0.1.1
File Size Uploaded Provenance
affineflow_nn-0.1.1.tar.gz 55.3 kB With provenance Details

Built distributions (wheels)

Table of built distributions (wheels) for AffineFlow-NN 0.1.1
File
affineflow_nn-0.1.1-cp314-cp314t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.14 CPython 3.14 free-threading Linux glibc 2.27+ x86-64, Linux glibc 2.28+ x86-64 Details
affineflow_nn-0.1.1-cp314-cp314t-macosx_26_0_arm64.whl CPython 3.14 CPython 3.14 free-threading macOS 26.0+ ARM64 Details
affineflow_nn-0.1.1-cp314-cp314-win_amd64.whl CPython 3.14 CPython 3.14 Windows x86-64 Details
affineflow_nn-0.1.1-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.14 CPython 3.14 Linux glibc 2.27+ x86-64, Linux glibc 2.28+ x86-64 Details
affineflow_nn-0.1.1-cp314-cp314-macosx_26_0_arm64.whl CPython 3.14 CPython 3.14 macOS 26.0+ ARM64 Details
affineflow_nn-0.1.1-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details
affineflow_nn-0.1.1-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.27+ x86-64, Linux glibc 2.28+ x86-64 Details
affineflow_nn-0.1.1-cp313-cp313-macosx_26_0_arm64.whl CPython 3.13 CPython 3.13 macOS 26.0+ ARM64 Details
affineflow_nn-0.1.1-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details
affineflow_nn-0.1.1-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
affineflow_nn-0.1.1-cp312-cp312-macosx_26_0_arm64.whl CPython 3.12 CPython 3.12 macOS 26.0+ ARM64 Details

Total release size: 57.7 MB

Release files / affineflow_nn-0.1.1.tar.gz

Download URL affineflow_nn-0.1.1.tar.gz
Size 55.3 kB
Tags Source
SHA-256 checksum
How to use checksums
d07e9852293a08a02a8f052573c2cbd39265b6e12e5328b10ac0247a663ca681
BLAKE2b-256 checksum
How to use checksums
c37193e6bb30817b8239e33f3c51007361212fc5428144470c2ab2cc7d657162
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.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 Aug 5, 2026.

Transparency log

Release files / affineflow_nn-0.1.1-cp314-cp314t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL affineflow_nn-0.1.1-cp314-cp314t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 13.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
f2980e14aa1bc322fd51873e01222e52f339a8a940f0b88ce28363af986efbb3
BLAKE2b-256 checksum
How to use checksums
c6785135c46f6bd5f7c963e426068406b27bedea62f019909461601ddddb9aed
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.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 Aug 5, 2026.

Transparency log

Release files / affineflow_nn-0.1.1-cp314-cp314t-macosx_26_0_arm64.whl

Download URL affineflow_nn-0.1.1-cp314-cp314t-macosx_26_0_arm64.whl
Size 538.9 kB
Tags CPython 3.14 CPython 3.14 free-threading macOS 26.0+ ARM64
SHA-256 checksum
How to use checksums
c39ae508ac0e769c5a6f496f2ffa16b61af82afd412d804dc4b01b43911630c0
BLAKE2b-256 checksum
How to use checksums
19c0c39bb2b7f45f5e7a77bb94f75216680888c0dd6b6789a468fbfb2677f4c3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.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 Aug 5, 2026.

Transparency log

Release files / affineflow_nn-0.1.1-cp314-cp314-win_amd64.whl

Download URL affineflow_nn-0.1.1-cp314-cp314-win_amd64.whl
Size 871.8 kB
Tags CPython 3.14 Windows x86-64
SHA-256 checksum
How to use checksums
66f77937b222fd53212eed343a739c0d889922afbb7e0d491be0da32ba33a132
BLAKE2b-256 checksum
How to use checksums
0bc80aff93424f69597ad92868fe8065701499534196c816412340b7f49f9252
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.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 Aug 5, 2026.

Transparency log

Release files / affineflow_nn-0.1.1-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL affineflow_nn-0.1.1-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 13.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
c9ae4dee2628824b8a521339d770aee73cb6f74ae8f0b9704762c9c2daa434ae
BLAKE2b-256 checksum
How to use checksums
41a23df242907ac47ed61a57d965e1822773334711df628fd1cd346ebcbd28ac
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.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 Aug 5, 2026.

Transparency log

Release files / affineflow_nn-0.1.1-cp314-cp314-macosx_26_0_arm64.whl

Download URL affineflow_nn-0.1.1-cp314-cp314-macosx_26_0_arm64.whl
Size 523.4 kB
Tags CPython 3.14 macOS 26.0+ ARM64
SHA-256 checksum
How to use checksums
af7ea892378ad13b9ebada7b59d0920a4eb489ee1d4beb03b966917b6d5cb453
BLAKE2b-256 checksum
How to use checksums
32518b764f7e57f670819acc276a03db2eaecb4a05dcb149b7e2c14431bb26f3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.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 Aug 5, 2026.

Transparency log

Release files / affineflow_nn-0.1.1-cp313-cp313-win_amd64.whl

Download URL affineflow_nn-0.1.1-cp313-cp313-win_amd64.whl
Size 845.6 kB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
04df44dc6fd1d0735934f59c6f754b416a1c3e9f77db9e4605ed879699049d51
BLAKE2b-256 checksum
How to use checksums
d8edb7dc623770cb089a4c47ff27dfb8ac7705cefc7e16e9284042f9e4b2951c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.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 Aug 5, 2026.

Transparency log

Release files / affineflow_nn-0.1.1-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL affineflow_nn-0.1.1-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 13.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
82c421def8fc6ded0799039a7a41813088f9485fca18faf1a456e4a034106468
BLAKE2b-256 checksum
How to use checksums
2ee9934c55541d9e578b1e884b15073c3a5dcde00a0677bf1d19fd4829fe128f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.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 Aug 5, 2026.

Transparency log

Release files / affineflow_nn-0.1.1-cp313-cp313-macosx_26_0_arm64.whl

Download URL affineflow_nn-0.1.1-cp313-cp313-macosx_26_0_arm64.whl
Size 522.7 kB
Tags CPython 3.13 macOS 26.0+ ARM64
SHA-256 checksum
How to use checksums
322117d07cff57f77d753ef740c6a5a3041c2118fe8ccc5df11738099e62f09c
BLAKE2b-256 checksum
How to use checksums
18d3c56b82a2b710146fcdd25564459ac9928dc0c34477401c36052dfc395004
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.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 Aug 5, 2026.

Transparency log

Release files / affineflow_nn-0.1.1-cp312-cp312-win_amd64.whl

Download URL affineflow_nn-0.1.1-cp312-cp312-win_amd64.whl
Size 845.5 kB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
5808dd766fc02cf2658b0a2035a86829cb8b56707cec35fb707367b32d83d75f
BLAKE2b-256 checksum
How to use checksums
04a5bbed63ae293637a373faabe29084cac809b961af33c6eef4f5607efb0d5d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.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 Aug 5, 2026.

Transparency log

Release files / affineflow_nn-0.1.1-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL affineflow_nn-0.1.1-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 13.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
2a1822e16368a3035d90b0d2f4cca9067505d1909659794e1ff7ebbb84b0d438
BLAKE2b-256 checksum
How to use checksums
9f57095fb315b27ebae693191fd10185fcebd7cb3b58ff9df8b0e8519ebd38ec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.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 Aug 5, 2026.

Transparency log

Release files / affineflow_nn-0.1.1-cp312-cp312-macosx_26_0_arm64.whl

Download URL affineflow_nn-0.1.1-cp312-cp312-macosx_26_0_arm64.whl
Size 522.7 kB
Tags CPython 3.12 macOS 26.0+ ARM64
SHA-256 checksum
How to use checksums
bb1ba3ec1a76f53cd491c8679da7a53a64e943ff5162ee6c6b00b845309c12fb
BLAKE2b-256 checksum
How to use checksums
86c0901eb17b3d1f48787bb04761f6af3859fc4d986394a0e7038a810d9e4a96
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.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 Aug 5, 2026.

Transparency log

Security for AffineFlow-NN 0.1.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.

Full provenance

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

Select from 12 files

Attestation for affineflow_nn-0.1.1.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 Aug 5, 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.

Release history Release notifications | RSS feed

This release

0.1.1 This release

12 release files Full 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