Skip to main content

axgrad

axon.png

Overview

It contains a framework similar to Numpy which allows to do basic matrix operations like element-wise add/mul + matrix multiplication + broadcasting. Also building pytorch like auto-differentiation engine: axgrad

Features

It has basic building blocks required to build a neural network:

  1. Basic tensor ops framework that could easily so matrix add/mul (element-wise), transpose, broadcasting, matmul, etc.
  2. A gradient engine that could compute and update gradients, automatically, much like micrograd, but on a tensor level ~ autograd like (work in progress!).
  3. Optimizer & loss computation blocks to compute and optimize (work in progress!). i'll be adding more things in future...

Usage

This shows basic usage of axgrad.engine & few of the axon's modules to preform tensor operations and build a sample neural network

anyway, prefer documentation for detailed usage guide:

  1. Usage.md: User documentation for AxGrad

Creating a MLP

To create a multi-layer perceptron in axgrad, you'll just need to follow the steps you followed in PyTorch. Very basic, initiallize two linear layers & a basic activation layer.

import axgrad
import axgrad.nn as nn

class MLP(nn.Module):
  def __init__(self, _in, _hid, _out, bias=False) -> None:
    super().__init__()
    self.layer1 = nn.Linear(_in, _hid, bias)
    self.gelu = nn.GELU()
    self.layer2 = nn.Linear(_hid, _out, bias)
  
  def forward(self, x):
    out = self.layer1(x)
    out = self.gelu(out)
    out = self.layer2(out)
    return out

refer to this Example for detailed info on making mlp

btw, here's the outputs i got from my simple implementation, that ran till 5kiters:

result

Contribution

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change. Please make sure to update tests as appropriate. But it's still a work in progress.

License

This project is licensed under the Apache 2.0 License - see the LICENSE file for details.

Release files for axgrad 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for axgrad 0.1.0
File Size Uploaded
axgrad-0.1.0.tar.gz 378.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for axgrad 0.1.0
File Interpreter ABI Platform
axgrad-0.1.0-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details

Total release size: 652.6 kB

Release files / axgrad-0.1.0.tar.gz

Download URL axgrad-0.1.0.tar.gz
Size 378.1 kB
Tags Source
SHA-256 checksum
How to use checksums
2d115903f58c443bcea658e9722f82a83156238d26eafd0ec5602838a36f6c02
BLAKE2b-256 checksum
How to use checksums
87bba4d45ba9a8c9a8a63e3db8f806efdfb78c7bcb99663a42b6e9c4ccc344c3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.3

Release files / axgrad-0.1.0-cp313-cp313-win_amd64.whl

Download URL axgrad-0.1.0-cp313-cp313-win_amd64.whl
Size 274.5 kB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
7cc3f82d584e2e7c082f38795390aac0ad72a2a5fb9cd67b9889d84fca48836d
BLAKE2b-256 checksum
How to use checksums
073e4d6107100a84fd576445e2e998940d279501d3216199b72d9050422794c3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.3

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page