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

2026-11-19来源 dev.toEnglish

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!

原文:https://www.a8q9.cn/en/article/microtorch-a-zero-dependency-tensor-autograd-engine-from-scratch-in-python-1074ef.html

相关文章