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

From the project README ·

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:

  1. 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.

  2. 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:

  1. In your JavaScript code, fetch the WebAssembly binary and initialize RTen using the init function.
  2. Fetch the prepared .onnx model and use it to an instantiate the Model class from this library.
  3. Each time you want to run the model, prepare one or more Float32Arrays containing input data in the format expected by the model, and call Model.run. This will return a TensorList that 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-opt tool from Binaryen can be used to optimize .wasm binaries 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.

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.

rten beside the projects that share a topic with it
ProjectDownloadsDependentsStarsLatest releaseRuns on (GPU)Native codeLicense
rten This page Featured

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
blazr App Listed

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
orkhon Listed Dormant

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

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
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 days
  • dormancy: last activity 2026-11-08, 1 days ago, E = 560: active
  • featured: 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
Adoption13 active dependents, 13 new dependents in 365 days1 not measured
Adoption measurements
SignalValueSourceFetchedCounts
Active dependents13crates.io database dumpYes
New dependents (365 days)13crates.io database dumpYes
Peak active dependents12crates.io database dumpYes
Active dependents as a share of the peak1crates.io database dumpYes
Binary downloads per releaseNot measuredYes
MaintenanceLatest human commit: 1 day ago3 not measured
Maintenance measurements
SignalValueSourceFetchedCounts
Latest human commit2026-11-08GitHub repositoryYes
Latest release2026-10-02crates.io database dumpYes
First release2023-12-31crates.io database dumpYes
Latest version0.27.0crates.io database dumpYes
Days the oldest outside issue waits for a reply0GitHub repositoryYes
Maintainer replies over 365 days39GitHub repositoryYes
Repository archivedfalseGitHub repositoryYes
Repository gonefalseGitHub repositoryYes
Release commit or manifest in the repotruecrates.io packageYes
Published docstruecrates.io database dumpYes
Latest release fails cargo checkNot measuredYes
Build check dateNot measuredYes
Build check toolchainNot measuredYes
SecurityUnpatched vulnerabilities: none
Security measurements
SignalValueSourceFetchedCounts
Unpatched vulnerabilities past the grace windownoneRustSec advisory databaseYes
RustSec unmaintained advisorynoneRustSec advisory databaseYes
Deprecation noticenonecrates.io database dumpYes
Deprecated requirementnonecrates.io database dumpYes
Distribution29 releases, 496,924 downloads over 30 days5 not measured
Distribution measurements
SignalValueSourceFetchedCounts
Releases29crates.io database dumpYes
Downloads over 30 days496924crates.io database dumpYes
Binary downloads over the last 3 releasesNot measuredYes
Homebrew installs on request over 365 daysNot measuredYes
Repology repository familiesNot measuredYes
Docker pull growth over 90 daysNot measuredYes
Docker pulls at the growth baselineNot measuredYes
Every version a prereleasefalsecrates.io database dumpYes
Every version 0.0.xfalsecrates.io database dumpYes
Every version yankedfalsecrates.io database dumpYes
Crate deleted from crates.iofalsecrates.io database dumpYes
Repository360 stars, 28 forks, 10 contributors, 5,000 commits. Stars alone never qualify a project.
Repository measurements
SignalValueSourceFetchedCounts
GitHub stars360GitHub repositoryYes — one part of the repository route
GitHub forks28GitHub repositoryYes — one part of the repository route
Contributors with a GitHub account10GitHub contributorsYes — one part of the repository route
Commits on the default branch5000GitHub repositoryNo
Repository's main crate left out of the entryrtencrates.io database dumpYes
Facts that never count
Facts that never count measurements
SignalValueSourceFetchedCounts
LicenseApache-2.0 OR MITcrates.io database dumpNo
Runs on, from listed crates and their direct dependenciesGPU support unknowncrates.io database dumpNo
What shows each backendno dependency or feature matches a backend rowcrates.io database dumpNo
Native code, from listed crates and their dependenciesNo native code foundcrates.io database dumpNo
Python bindings, from direct dependencies of listed cratesNo Python binding crate foundcrates.io database dumpNo
Crates that depend on a listed crate directly29crates.io database dumpNo

Corrections and review history

Report a correction

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.