Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Added
- ONNX interpreter support for Conv2d, fused BatchNormalization, MaxPool2d,
AveragePool2d, and GlobalAveragePool.
- GitHub Actions CI: `cargo build`, `cargo fmt` / `cargo clippy` (non-blocking),
and Python tests via `maturin develop`.
- Branch protection on `main`: pull requests required, `cargo build` and
`python tests (maturin)` checks required to merge.
- ONNX interpreter with Gemm, Linear, Relu, Sigmoid, Tanh, Gelu, Softmax,
LogSoftmax, Add, Sub, Mul, Div, Reshape, Flatten, and Transpose ops.
- Zero-copy numpy ↔ Burn tensor bridge (`roundtrip`).
- Initial maturin/pyo3 project scaffold, `burn-flex` + `onnx-ir` dependencies.

[Unreleased]: https://github.com/asjad2401/burn-python/commits/main
30 changes: 25 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,46 @@
# burn-python

[![CI](https://github.com/asjad2401/burn-python/actions/workflows/ci.yml/badge.svg)](https://github.com/asjad2401/burn-python/actions/workflows/ci.yml)

Python inference frontend for the [Burn](https://github.com/tracel-ai/burn) deep learning framework.

Load any ONNX model and run inference from Python — numpy in, numpy out. No Rust required.
Load an ONNX model and run inference from Python — numpy in, numpy out. No Rust required.

```python
import burn_python as burn
import numpy as np

model = burn.load_onnx("resnet50.onnx")
output = model(np.random.randn(1, 3, 224, 224).astype(np.float32))
model = burn.load_onnx("model.onnx")
x = np.random.randn(1, 3, 224, 224).astype(np.float32)
output = model([x])[0]
```

## Status

Early development. Stage 1 (numpy ↔ Burn tensor bridge) in progress.
Early development. The numpy ↔ Burn tensor bridge is done, and the ONNX interpreter
currently supports:

- **Linear algebra**: Gemm, Linear
- **Activations**: Relu, Sigmoid, Tanh, Gelu, Softmax, LogSoftmax
- **Elementwise**: Add, Sub, Mul, Div
- **Shape ops**: Reshape, Flatten, Transpose
- **Conv/pooling**: Conv2d, BatchNormalization (fused), MaxPool2d, AveragePool2d, GlobalAveragePool

Enough to run simple MLPs and small CNNs; more ops are being added incrementally.

## Building

```bash
pip install maturin
maturin develop
maturin develop --release
```

## Testing

```bash
python tests/make_test_model.py # generates tests/mlp.onnx
python tests/test_bridge.py # numpy <-> Burn tensor bridge
python tests/compare_ort.py # correctness + perf vs ONNX Runtime
```

## License
Expand Down
Loading