A PyTorch‑inspired deep learning library written in pure TypeScript, designed to run on both Node.js (with WebGPU) and in browsers. Built for education and production, with a focus on a clean API and zero external dependencies (except @webgpu/types for GPU support).
- PyTorch‑like API:
tensor.matmul,nn.Linear,loss.backward()– feel right at home. - Autograd engine: dynamic computation graph with automatic differentiation.
- Modular design: easily extend with new layers, optimizers, and loss functions.
- CPU + WebGPU ready: runs on CPU by default, with a clear path to GPU acceleration via WebGPU compute shaders.
- Zero heavy dependencies: no TF.js, no ONNX – only TypeScript and the WebGPU API.
git clone https://github.com/mustapha-devstack/tinytorch.git
cd tinytorch
npm install ts-node
npx ts-node examples/01_linear_regression.ts