xnn
A lightweight ML framework built from scratch in Rust with GPU-first architecture.
Features
- GPU acceleration via wgpu (Vulkan, Metal, DX12, WebGPU)
- Element types:
f32,i32,u32,bool - Cross-platform: Linux, macOS, Windows, Web/WASM
- Automatic compute pipeline caching
- No unsafe code
Tensor
N-dimensional array with GPU-accelerated operations and automatic broadcasting.
Elements
| Type | Numeric | Signed | Integer | Float | Logical |
|---|---|---|---|---|---|
f32 |
✓ | ✓ | ✓ | ||
i32 |
✓ | ✓ | ✓ | ||
u32 |
✓ | ✓ | |||
bool |
✓ |
Examples
MNIST Training
Trains a fully-connected network on the MNIST dataset.
MNIST Web
Interactive digit recognition in the browser using WebGPU and WASM.
Linear regression
Trains a simple linear model to fit y = wx + b.
XOR
Trains a 2-layer neural network to solve the XOR problem.
License
MIT — see LICENSE for details.