百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
T

Tinytorch

> 编程语言
开源

一个非常小的自动微分引擎

100 stars0 点赞0 次浏览
访问官网GitHub

工具介绍

一个非常小的自动微分引擎

tinytorch

Newest ML framework that you propbaly don't need,

this is really autograd engine backed by numpy

tinytorch.py shall always remain under 1000 lines. if not we will revert commit

$$ f(x) =x^3+x $$

python
import tinytorch as tt      #

def f(x):
  return x**3 + x

x = tt.tensor((tt.arange(700) - 400)/100 , requires_grad=True)
z = f(x)
z.sum().backward()
print(x.grad)

What can you do with it?

Automatic diffecrtion, yep

python
import tinytorch as tt 

def f(x,y):
  return x**2 + x*y + (y**3+y) **0.5

x = tt.rand((5,5), requires_grad=True)
y = tt.rand((5,5), requires_grad=True)
z = f(x,y)
z.sum().backward()
print(x.grad)
print(y.grad)

Train MNITST, no problemo

bash
python mnist.py

GPT?? you bet (yes LLM fr fr)

bash
GPU=1 python mnist.py

note: numpy is too slow to train llm you need to install jax (just using it as faster numpy)

Visulization

If you want to see your computation graph run visulize.py

requirements

bash
pip install graphviz
sudo apt-get install -y graphviz # IDK what to do for windows I use wsl

why this exists

Bcs I was bored

DEV BLOG

  • Part 1: pythonstuff/build-tensors
  • Part 2: pythonstuff/backward-pass
  • Part 3: pythonstuff/refactor-&-cleanup
  • Part 4: pythonstuff/boradcasting

powerlevel

1.0 - karpathy micrograd (really simple, not much you can do with it)

3.14 - tinytorch (simpile and you can do lot of things with it) <= ❤️

69 - tinygrad (no longer simple you can do lot more)

∞ - pytorch (goat library, that makes gpu go burrr)

contribution guideline

  • be nice
  • performance optimization / more examples welcome
  • doc sources if any
  • keep tinytorch.py under 1000 lines

Buy me Chai/Coffee

License

MIT

Issues· 2 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Python

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言