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.7.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.7-py3-none-any.whl (9.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: aino-2.1.7.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.7.tar.gz
Algorithm Hash digest
SHA256 1f579412e18ed082790cb3af20c189c78b7187810363f9fc202e4817c7bc8157
MD5 a05b36c008f2d3f10fadc6f775f0ab43
BLAKE2b-256 92693d1cdb56cc1d699e5b70271bcd0f9aa19b9037219dbd8de0c293dafa982e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: aino-2.1.7-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.7-py3-none-any.whl
Algorithm Hash digest
SHA256 6936f423710e3b34770fdc84a35523322e714770d6a38ffda2c96646c4c30c09
MD5 6416a5e1759785a18f9a76809780f1c2
BLAKE2b-256 fb0a4514a370bc1dd0e5f83540c7ba4bf199a1ad5eb8132d10031c7624cb5896

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