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.0.1.tar.gz (168.1 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.0.1-py3-none-any.whl (8.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: aino-2.0.1.tar.gz
  • Upload date:
  • Size: 168.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

Hashes for aino-2.0.1.tar.gz
Algorithm Hash digest
SHA256 8dcdf88f517c6f125e49da0fb31301afa24810278c9f54c7acf16a4d69e249c6
MD5 0931883b9e5313d81d51dfbcc9f38cf0
BLAKE2b-256 d3f9122bc8ef8a3a34ce6042a6140daf3c8698254a0e9f7f6d9ab37e9951ae51

See more details on using hashes here.

File details

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

File metadata

  • Download URL: aino-2.0.1-py3-none-any.whl
  • Upload date:
  • Size: 8.6 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.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 82433c6ae1ad59401b48d4fd8a006b4f390ec44596f9ba89b9251a516998fbe6
MD5 0970892a19657b8d4cfd3dd073efdf87
BLAKE2b-256 778fcdfdcbac9049a2ee4c822d475ab3124bd6346cb80eb26e6d0b374ce651d8

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