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.0.tar.gz (169.9 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.0-py3-none-any.whl (9.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: aino-2.1.0.tar.gz
  • Upload date:
  • Size: 169.9 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.0.tar.gz
Algorithm Hash digest
SHA256 db3fd8743db834a49a0372295cdc056c97f7e1cf5744fa34477d0b7a29128da0
MD5 fb630bb6411a308ec946a5678d22f0ea
BLAKE2b-256 492f05e93c37fd71580d9999e05a75a1af37425f9746b4fb93826e95ac4b1e07

See more details on using hashes here.

File details

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

File metadata

  • Download URL: aino-2.1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.2 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 575d32d4a7cdb57ae3b6cfa722431543cc178dd982bf3bab530c2c9d83f16573
MD5 45c4306b17429374c946f7c1928fa51d
BLAKE2b-256 ac008084ca6ea059a5460380cc55e8e8cc3a85a616ec5d0b6db8b117ee5ba6fb

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