Multi-dimensional array creation & manipulation library like numpy written from scratch in Python along with a scalar level autograd engine written in C/C++ with Python wrapper
Project description
Axon Library
Axon: is a lightweight Python library for creating and manipulating multi-dimensional arrays, inspired by libraries such as NumPy. It's written in python only, for now.
Axon.micro: You have seen Micrograd by Karpathy, this is the upgraded version of micrograd written in c/c++ & has more functions & operational support. A light weight scalar-level autograd engine written in c/c++ & python
Features
- Element-wise operations (addition, multiplication, etc.)
- Matrix multiplication
- Broadcasting
- Activation functions (ReLU, tanh, sigmoid, GELU)
- Reshape, transpose, flatten
- Data type conversion
- Micrograd support(Scalar level autograd engine)
Installation
Clone the repository:
git clone https://github.com/shivendrra/axon.git
cd axon
or
Install via pip:
pip install axon-pypi
Usage
You can use this similar to micrograd to build a simple neural network or do scalar level backprop.
Axon.array
import axon
from axon import array
# Create two 2D arrays
a = array([[1, 2], [3, 4]], dtype=axon.int32)
b = array([[5, 6], [7, 8]], dtype=axon.int32)
# Addition
c = a + b
print("Addition:\n", c)
# Multiplication
d = a * b
print("Multiplication:\n", d)
# Matrix Multiplication
e = a @ b
print("Matrix Multiplication:\n", e)
Output:
Addition:
array([6, 8], [10, 12], dtype=int32)
Multiplication:
array([5, 12], [21, 32], dtype=int32)
Matrix Multiplication:
array([19, 22], [43, 50], dtype=int32)
anyway, prefer documentation for detailed usage guide:
- axon.md: for development purpose
- usage.md: for using it like numpy
- axon_micro.md: for axon.micro i.e. scalar autograd engine
Axon.micro
from axon.micro import scalar
a = scalar(2)
b = scalar(3)
c = a + b
d = a * b
e = c.relu()
f = d ** 2.0
f.backward()
print(a)
print(b)
print(c)
print(d)
print(e)
print(f)
you can even checkout example neural networks to run them on your system, or build your own :-D.
Forking the Repository
If you would like to contribute to this project, you can start by forking the repository:
- Click the "Fork" button at the top right of this page.
- Clone your forked repository to your local machine:
git clone https://github.com/shivendrra/axon.git
- Create a new branch:
git checkout -b my-feature-branch
- Make your changes.
- Commit and push your changes:
git add .
git commit -m "Add my feature"
git push origin my-feature-branch
- Create a pull request on the original repository.
Testing
To run the unit tests you will have to install PyTorch & Numpy, which the tests use as a reference for verifying the correctness of the calculated gradients & calculated values. Then simply run each file according to your prefrence:
python -m tests/test_array.py # for testing the axon functions with numpy
python -m tests/test_micro.py # for testing the axon.micro functions with pytorch
Contributing
We welcome contributions! Please follow these steps to contribute:
- Fork the repository.
- Create a new branch for your feature or bugfix.
- Make your changes.
- Ensure all tests pass.
- Submit a pull request with a clear description of your changes.
License
This project is licensed under the MIT License. See the LICENSE file for more details.
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
Built Distribution
File details
Details for the file axon-pypi-1.0.3.tar.gz
.
File metadata
- Download URL: axon-pypi-1.0.3.tar.gz
- Upload date:
- Size: 720.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ec887dfcef5bdfe9fdf1e50f564878b02c7c40c3ea5086104c5e411332f6e9d1 |
|
MD5 | 77e4b63aa50a4a0b1cff3e39128ede5f |
|
BLAKE2b-256 | 7fed142d6b25b77b88859d46986893f57e9748db1cb256ee62f98bbf7048c045 |
File details
Details for the file axon_pypi-1.0.3-py3-none-any.whl
.
File metadata
- Download URL: axon_pypi-1.0.3-py3-none-any.whl
- Upload date:
- Size: 727.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e1e541672f54aab7fa72a7c970c942278942d66e3286f548751b66d26f191000 |
|
MD5 | 8299b8f2021178678a299e2248128156 |
|
BLAKE2b-256 | 85a508bb60276ee3dc68250349a07cec3f824c7079ec0567fbc2dbe422a18276 |