Skip to content

p2ratik/Microtensor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Microtensor

Microtensor is a small autograd-style engine inspired by the micrograd library. It provides a minimal tensor API, basic layers, loss functions, and a tiny MLP for experiments. It also supports GPU training via CuPy when a CUDA device is available.

Features

  • Autograd-style Tensor with backward propagation
  • Core activations: ReLU, Leaky ReLU, Tanh, Sigmoid
  • Loss functions: MSE, Binary Cross Entropy, Softmax Loss
  • Simple MLP with dropout
  • GPU training support (CuPy) with automatic fallback to NumPy

Quick Example

from api.tensor import Tensor
from api.loss import MSE_loss

# simple forward
x = Tensor([[1.0, -2.0, 3.0]])
y = Tensor([[0.0, 1.0, 0.0]])

out = x.tanh()
loss = MSE_loss(out, y)

# backward
loss.backward()

print("loss:", loss.data)
print("grad:", x.grad)

GPU Support

If cupy is installed and a CUDA-capable GPU is available, the engine will use GPU arrays automatically. Otherwise, it falls back to NumPy.

Running Training Scripts

From the project root:

python -m traning.titanic

license - MIT

About

Autograd engine like tensorflow

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors