DEV Community

Yashraj Miyatra
Yashraj Miyatra

Posted on

MicroTorch: A Zero-Dependency Tensor Autograd Engine from Scratch in Python

Hey everyone! πŸš€

I wanted to share MicroTorch, a lightweight tensor autograd engine and deep learning framework built from scratch in pure Python with zero external dependencies (no NumPy, no PyTorch).

🌟 Key Features

  • Reverse-Mode Autograd: Dynamic computation graph DAG with topological sort backpropagation.
  • N-Dimensional Tensors: Batched matrix multiplication (@), broadcasting, and reduction operators.
  • Modular Layers: Linear, Sequential, ReLU, Sigmoid, Tanh, MSELoss, CrossEntropyLoss.
  • Optimizers: SGD (with momentum), Adam, and AdamW (with decoupled weight decay).
  • Visual Computation Graphs: ASCII trees and Mermaid diagrams.

Check out the code, architecture, and tests here:
πŸ‘‰ https://github.com/YashrajMiyatra/microtorch

Would love your thoughts, feedback, and stars on GitHub!

Top comments (0)