Skip to main content

AINO Is Neural Operation: A lightweight, educational neural network library.

Project description

AINO (Aino is Neural Operation)

AINO Banner

"Aino is Neural Operation." > A custom-built, highly optimized Deep Learning framework built from scratch using pure Python, and NumPy.

PyPI version License: MIT


🌟 Inspiration

This project was born out of curiosity after watching this inspiring video:
MIT Introduction to Deep Learning | 6.S191

I didn't want to just import tensorflow and call it a day. I wanted to see directly how the magic happens under the hood. I wanted to feel the weight of the matrices, understand the flow of the gradients, and build the brain from scratch.

⚡ The Tech Stack (Hardware Agnostic)

AINO is built to be educational yet blazingly fast. It uses an Agnostic Backend:

  • CPU Mode: Uses pure NumPy with contiguous memory optimization.
  • GPU Mode: Automatically detects and switches to CuPy if an NVIDIA GPU is available, providing massive parallel acceleration without changing a single line of your code.
  • No Black Boxes: Every Forward Pass and Backpropagation step is manually calculated.

✨ Features

  • Flexible Architecture: Define any number of layers and neurons (e.g., [784, 128, 64, 10]).
  • Vectorized Operations: Dropped slow loop-based perceptrons in favor of highly optimized matrix multiplications.
  • Mini-Batch Gradient Descent: Train on large datasets (like MNIST) efficiently.
  • Activation Functions: Supports Sigmoid, ReLU, and Tanh.
  • Universal Serialization: Safely save (.dit) and load models across different machines, whether they have a GPU or not.

🧠 What I Learned

Building AINO from the ground up gave me insights that high-level libraries often hide:

  1. From OOP to Vectorization: I initially built the network iterating over individual Perceptrons. I quickly learned that Python loops are slow. Refactoring the Layer class to use pure Matrix Calculus (np.dot) reduced training time from 32 minutes to just 19 seconds!
  2. The Calculus of Backpropagation: I implemented the Chain Rule manually, computing derivatives for activations and understanding how error gradients propagate from the output back to the input layers.
  3. Memory Management & Hardware: I learned the critical difference between RAM and VRAM, how to use ascontiguousarray for CPU caching, and how to safely bridge data between CPU and GPU using CuPy.

💻 Usage Example

from aino.model import NeuralNetwork

# Create a network for MNIST (784 inputs, 2 hidden layers, 10 outputs)
model = NeuralNetwork([784, 128, 64, 10], activation_type='tanh')

# Train using Mini-Batch Gradient Descent (Auto CPU/GPU)
model.fit(X_train, y_train, epochs=100, n=0.01, batch_size=32, verbose=True)

# Make predictions
predictions = model.predict(X_test)

# Save the universally loadable .dit model
model.save('aino_mnist.dit')

Built with ❤️ using Python.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aino-2.1.5.tar.gz (169.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

aino-2.1.5-py3-none-any.whl (9.1 kB view details)

Uploaded Python 3

File details

Details for the file aino-2.1.5.tar.gz.

File metadata

  • Download URL: aino-2.1.5.tar.gz
  • Upload date:
  • Size: 169.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for aino-2.1.5.tar.gz
Algorithm Hash digest
SHA256 8985fd238e82cfade1d265fd1724dcbea85a48c5a987cb29372e4ef10561f849
MD5 af8b9064a3f22b21c91a9d2a2003d04d
BLAKE2b-256 1b3a9054d03e20ce4ad3c0d441e072d1bd5a3c2631822bc4682977b314639be4

See more details on using hashes here.

File details

Details for the file aino-2.1.5-py3-none-any.whl.

File metadata

  • Download URL: aino-2.1.5-py3-none-any.whl
  • Upload date:
  • Size: 9.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for aino-2.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 b1184951e106362c27b395c3203ca6de769da23088f1cb63cb9b0e92cbd1b140
MD5 06acca03d59457b1dc5eba1f1282b1d5
BLAKE2b-256 73233bf77f34c696ff66bedb086930ca3508cab1939efae10bc0bed9f286801e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page