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.2.tar.gz (170.0 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.2-py3-none-any.whl (9.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: aino-2.1.2.tar.gz
  • Upload date:
  • Size: 170.0 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.2.tar.gz
Algorithm Hash digest
SHA256 8d14537646d1e39c91556629ae18cd7d7d13b6e2a04940816e9e0ba60f25e05c
MD5 284d5f1fa42820dcfdfcddba35b33bd1
BLAKE2b-256 86ee336719789c8226964d0812eca6320a13d71ee93237c78e9b67b0ffedda57

See more details on using hashes here.

File details

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

File metadata

  • Download URL: aino-2.1.2-py3-none-any.whl
  • Upload date:
  • Size: 9.3 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a1d5bbd29cfaaafc3cbbb21d9df03817fcc8cadb575c09096ea7885f0c65f5e7
MD5 66e7d293cb21182c21d9283866c521ff
BLAKE2b-256 54b449a422900c6b9341a095eddd0ba727078d81246135476648c4f9c5188dd4

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