rten
Library Featured
Tensor library for the RTen machine learning runtime
- Downloads
- 496,924
- Dependents
- 29
- Stars
- 360
- Forks
- 28
- Contributors
- 10
- Commits
- 5,000
- Latest release
- 0.27.0 ·
About
RTen (the Rust Tensor engine) † is a machine learning runtime. It supports models in ONNX format. RTen enables you to take machine learning models which have been trained in Python using frameworks such as PyTorch and run them in Rust.
In addition to ML inference, the project also provides supporting libraries for common pre-processing and post-processing tasks in various domains. This makes RTen a more complete toolkit for running models in Rust applications.
† The name is also a reference to PyTorch's ATen library.
Goals
- Provide a (relatively) small and efficient neural network runtime that makes it easy to take models created in frameworks such as PyTorch and run them in Rust applications.
- Be easy to compile and run on a variety of platforms, including WebAssembly
- End-to-end Rust. This project and all of its required dependencies are written in Rust. This simplifies the build and deployment process.
Supported devices
RTen currently supports CPU inference only. It supports SIMD via AVX2, AVX-512, Arm Neon and WebAssembly SIMD. Inference uses multiple threads by default, defaulting to the number of physical cores (or performance cores). This can be customized.
Read the full README
Supported models
Operators
RTen supports most standard ONNX operators. See this tracking issue for details. Please open an issue if you find that you cannot run a model because an operator is not supported.
RTen additionally supports some "contrib" ops. These are non-standard operators supported by ONNX Runtime. They are supported for compatibility with widely deployed models. Support for new contrib ops is added on an as-needed basis.
Data types
RTen supports models with single-precision float (f32) weights and quantized
models with int8 weights. Models with half-precision (f16) weights are
partially supported - weights are upconverted to f32 when the model is loaded.
Getting started
The best way to get started is to clone this repository and try running some of the examples locally. Many of the examples use Hugging Face's Optimum or other Python-based tools to export the ONNX model, so you will need a recent Python version installed.
The examples are located in the rten-examples/ directory. See the README for descriptions of all the examples and steps to run them. As a quick-start, here are the steps to run the image classification example:
git clone https://github.com/robertknight/rten.git
cd rten
# Install dependencies for Python scripts
pip install -r tools/requirements.txt
# Export an ONNX model. We're using resnet-50, a classic image classification model.
python -m tools.export-timm-model timm/resnet50.a1_in1k
# Run image classification example. Replace `image.png` with your own image.
cargo run -p rten-examples --release --bin imagenet resnet50.a1_in1k.onnx image.png
Usage in JavaScript
To use this library in a JavaScript application, there are two approaches:
Prepare model inputs in JavaScript and use the rten library's built-in WebAssembly API to run the model and return a tensor which will then need to be post-processed in JS. This approach may be easiest for tasks where the pre-processing is simple.
The image classification example uses this approach.
Create a Rust library that uses rten and does pre-processing of inputs and post-processing of outputs on the Rust side, exposing a domain-specific WebAssembly API. This approach is more suitable if you have complex and/or computationally intensive pre/post-processing to do.
Before running the examples, you will need to follow the steps under "Building the WebAssembly library" below.
The general steps for using RTen's built-in WebAssembly API to run models in a JavaScript project are:
- In your JavaScript code, fetch the WebAssembly binary and initialize RTen
using the
initfunction. - Fetch the prepared
.onnxmodel and use it to an instantiate theModelclass from this library. - Each time you want to run the model, prepare one or more
Float32Arrays containing input data in the format expected by the model, and callModel.run. This will return aTensorListthat provides access to the shapes and data of the outputs.
After building the library, API documentation for the Model and TensorList
classes is available in dist/rten.d.ts.
Building the WebAssembly library
Prerequisites
To build RTen for WebAssembly you will need:
- A recent stable version of Rust
just- (Optional) The
wasm-opttool from Binaryen can be used to optimize.wasmbinaries for improved performance - (Optional) A recent version of Node for running demos
Building rten
git clone https://github.com/robertknight/rten.git
cd rten
just wasm
The build created by just wasm requires support for WebAssembly SIMD,
available since Chrome 91, Firefox 89 and Safari 16.4. It is possible to
build the library without WebAssembly SIMD support using just wasm-nosimd,
or both using just wasm-all. The non-SIMD builds are significantly slower.
At runtime, you can find out which build is supported by calling the
binaryName() function exported by this package.
Compatibility
- Runs on
- GPU support unknown
What shows it
- no dependency or feature matches a backend row
- Native code
- None found
- No native code found
- Python bindings
- No Python binding crate found
- License
- Apache-2.0 OR MIT
Compare with similar projects
Order: strongest tier first, then most downloads, then name, with unmeasured values last. A library counts downloads over 30 days. An app counts binary downloads per release. An app with none counts its crate downloads over 30 days. ML Rust runs this catalogue, so its closest project always gets a row.
| Project | Downloads | Dependents | Stars | Latest release | Runs on (GPU) | Native code | License |
|---|---|---|---|---|---|---|---|
|
Tensor library for the RTen machine learning runtime |
496,924 downloads over 30 days | 29 | 360 | 0.27.0 | GPU support unknown | No native code found | Apache-2.0 OR MIT |
|
ort Featured
A safe Rust wrapper for ONNX Runtime 1.31 - Optimize and accelerate machine learning inference & training |
3,902,768 downloads over 30 days | 694 | 2,611 | 2.0.0-rc.15 | CUDA, WebGPU, ROCm | Binds native code: onnxruntime, ort-sys. Build uses a native toolchain: pkg-config (feature pkg-config) | Apache-2.0 OR MIT |
|
orp Listed
Lightweight framework for building ONNX runtime pipelines with ort |
41,463 downloads over 30 days | 6 | 14 | 1.0.0 | CUDA, ROCm | Binds native code: ort-sys | Apache-2.0 |
|
lele Listed
Bare-metal machine learning inference library in Rust |
132 downloads over 30 days | 1 | 183 | 0.2.0 | GPU support unknown | No native code found | MIT |
|
Inference server for LLMs, speech and embeddings: OpenAI-compatible routes with streaming, plus speech synthesis (TTS) and transcription (ASR). Serves Llama, Mistral, Qwen, Mamba2, MLA+MoE and hybrid models from SafeTensors, AWQ, GPTQ and GGUF. |
8 binary downloads per release | Not applicable | 7 | 0.7.1 | CUDA, WebGPU | Binds native code: ring (feature distributed) | Apache-2.0 |
|
Machine Learning Inference Framework and Server Runtime Python bindings |
0 downloads over 30 days | 0 | 153 | 0.2.3 | GPU support unknown | No native code found | MIT |
|
needle-rs New
600 KB WASM runtime for Cactus Compute's Needle AI tool-calling models, Needle 3, 2 and 1 from one build. Browser, Cloudflare Workers, Node.js, Python, C FFI and no_std. Token-exact with the JAX reference. No backend, no API key. |
126 downloads over 30 days | 0 | 107 | 0.3.1 | GPU support unknown | No native code found | MIT |
All projects in Run and serve modelsAll projects in Tensors and GPU compute
Why FeaturedIt passes every Featured gate.
What it meets
- It has 13 active dependents and 13 new dependents in 365 days. Featured needs 11 active dependents or 9 new dependents in 365 days.
- Active dependents are at 100% of their peak. Featured needs at least 50%.
- Docs are present. The release commit or a manifest ties the crate to the repository.
- No vulnerability advisory stays unpatched past the grace window. At least one version is neither a prerelease nor 0.0.x.
- The last activity is on 8 Nov 2026, 1 day ago. The rules expect an update within 560 days. Dormancy rule
Exact rules: Featured library. The check on applied thresholds version 9.
Every rule outcome, as the check records it
expected-interval: version 0.27.0 base 140, doubled for 496924 downloads per month, doubled for 13 active users: E = 560 daysdormancy: last activity 2026-11-08, 1 days ago, E = 560: activefeatured: featured: active_users 13, new_adopters 13, former_glory 1
Crates6 crates
Measurements and sources
Each signal row shows the raw value, its source and the fetch date. The Sources list gathers every distinct source on this page. Movement needs more history.
Sources6 sources
- Description: the crates.io description
- crates.io database dump, fetched
- RustSec advisory database, fetched
- GitHub repository, fetched
- crates.io package, fetched
- GitHub contributors, fetched
Adoption13 active dependents, 13 new dependents in 365 days1 not measured
| Signal | Value | Source | Fetched | Counts |
|---|---|---|---|---|
| Active dependents | 13 | crates.io database dump | Yes | |
| New dependents (365 days) | 13 | crates.io database dump | Yes | |
| Peak active dependents | 12 | crates.io database dump | Yes | |
| Active dependents as a share of the peak | 1 | crates.io database dump | Yes | |
| Binary downloads per release | Not measured | Yes |
MaintenanceLatest human commit: 1 day ago3 not measured
| Signal | Value | Source | Fetched | Counts |
|---|---|---|---|---|
| Latest human commit | 2026-11-08 | GitHub repository | Yes | |
| Latest release | 2026-10-02 | crates.io database dump | Yes | |
| First release | 2023-12-31 | crates.io database dump | Yes | |
| Latest version | 0.27.0 | crates.io database dump | Yes | |
| Days the oldest outside issue waits for a reply | 0 | GitHub repository | Yes | |
| Maintainer replies over 365 days | 39 | GitHub repository | Yes | |
| Repository archived | false | GitHub repository | Yes | |
| Repository gone | false | GitHub repository | Yes | |
| Release commit or manifest in the repo | true | crates.io package | Yes | |
| Published docs | true | crates.io database dump | Yes | |
| Latest release fails cargo check | Not measured | Yes | ||
| Build check date | Not measured | Yes | ||
| Build check toolchain | Not measured | Yes |
SecurityUnpatched vulnerabilities: none
| Signal | Value | Source | Fetched | Counts |
|---|---|---|---|---|
| Unpatched vulnerabilities past the grace window | none | RustSec advisory database | Yes | |
| RustSec unmaintained advisory | none | RustSec advisory database | Yes | |
| Deprecation notice | none | crates.io database dump | Yes | |
| Deprecated requirement | none | crates.io database dump | Yes |
Distribution29 releases, 496,924 downloads over 30 days5 not measured
| Signal | Value | Source | Fetched | Counts |
|---|---|---|---|---|
| Releases | 29 | crates.io database dump | Yes | |
| Downloads over 30 days | 496924 | crates.io database dump | Yes | |
| Binary downloads over the last 3 releases | Not measured | Yes | ||
| Homebrew installs on request over 365 days | Not measured | Yes | ||
| Repology repository families | Not measured | Yes | ||
| Docker pull growth over 90 days | Not measured | Yes | ||
| Docker pulls at the growth baseline | Not measured | Yes | ||
| Every version a prerelease | false | crates.io database dump | Yes | |
| Every version 0.0.x | false | crates.io database dump | Yes | |
| Every version yanked | false | crates.io database dump | Yes | |
| Crate deleted from crates.io | false | crates.io database dump | Yes |
Repository360 stars, 28 forks, 10 contributors, 5,000 commits. Stars alone never qualify a project.
| Signal | Value | Source | Fetched | Counts |
|---|---|---|---|---|
| GitHub stars | 360 | GitHub repository | Yes — one part of the repository route | |
| GitHub forks | 28 | GitHub repository | Yes — one part of the repository route | |
| Contributors with a GitHub account | 10 | GitHub contributors | Yes — one part of the repository route | |
| Commits on the default branch | 5000 | GitHub repository | No | |
| Repository's main crate left out of the entry | rten | crates.io database dump | Yes |
Facts that never count
| Signal | Value | Source | Fetched | Counts |
|---|---|---|---|---|
| License | Apache-2.0 OR MIT | crates.io database dump | No | |
| Runs on, from listed crates and their direct dependencies | GPU support unknown | crates.io database dump | No | |
| What shows each backend | no dependency or feature matches a backend row | crates.io database dump | No | |
| Native code, from listed crates and their dependencies | No native code found | crates.io database dump | No | |
| Python bindings, from direct dependencies of listed crates | No Python binding crate found | crates.io database dump | No | |
| Crates that depend on a listed crate directly | 29 | crates.io database dump | No |
Corrections and review history
No correction applies to this entry.
Judgments
A judgment enters only through an approved issue and a merged pull request.
No judgment applies to this entry.