AINO Is Neural Operation: A lightweight, educational neural network library.
Project description
AINO (Aino is Neural Operation)
"Aino is Neural Operation." > A custom-built, highly optimized Deep Learning framework built from scratch using pure Python, and NumPy.
🌟 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
NumPywith contiguous memory optimization. - GPU Mode: Automatically detects and switches to
CuPyif 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, andTanh. - 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:
- From OOP to Vectorization: I initially built the network iterating over individual Perceptrons. I quickly learned that Python loops are slow. Refactoring the
Layerclass to use pure Matrix Calculus (np.dot) reduced training time from 32 minutes to just 19 seconds! - 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.
- Memory Management & Hardware:
I learned the critical difference between RAM and VRAM, how to use
ascontiguousarrayfor CPU caching, and how to safely bridge data between CPU and GPU usingCuPy.
💻 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file aino-2.2.0.tar.gz.
File metadata
- Download URL: aino-2.2.0.tar.gz
- Upload date:
- Size: 171.1 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3db29b1785503e395e9f735e76c06cb182a89e7fd443d8865b71fd2fdb134c85
|
|
| MD5 |
6683755e1900c4f80c487146502cd497
|
|
| BLAKE2b-256 |
37f4832ab6d21c18b16b8f1ed6d50a8837830cb6ee248048d0347acda003f217
|
File details
Details for the file aino-2.2.0-py3-none-any.whl.
File metadata
- Download URL: aino-2.2.0-py3-none-any.whl
- Upload date:
- Size: 10.4 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7b4a9d6af48d2df9c65cfdff2049d665ba66408171786cde686f16d05312fd52
|
|
| MD5 |
24f860743c497c5f4beb0ac8bc2aa7a9
|
|
| BLAKE2b-256 |
fd76a947d416b18a6bf4dc2d60a5392134922bfc46abcb4a927947724573f259
|