Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

rten (Python)

Python bindings for RTen, a machine learning runtime for models in ONNX format.

Usage

import numpy as np
import rten

model = rten.Model("model.onnx")

for input in model.get_inputs():
    print(input.name, input.type, input.shape)

outputs = model.run(None, {"input": np.zeros((1, 3, 224, 224), np.float32)})

Model.run takes a list of output names, or None for all of the model's outputs, and a dict mapping input names to numpy arrays. It returns a list of numpy arrays.

Porting from ONNX Runtime

The API is similar to ONNX Runtime. Basic use of ort.InferenceSession can be ported with a simple class name change:

session = ort.InferenceSession("model.onnx")  # ONNX Runtime
model = rten.Model("model.onnx")              # RTen

Caveats

  • RTen represents int64 and bool tensors as int32, and float64 tensors as float32. Inputs in those dtypes are converted for you, but outputs that a model declares as int64 or bool come back as int32, and get_inputs() / get_outputs() report them as tensor(i32). An int64 input containing a value too large for int32 raises OverflowError.

  • float16 inputs are not supported. Convert them with array.astype(np.float32).

Errors that RTen reports when loading or running a model raise rten.RtenError.

Development

To build and test the bindings locally, first install uv. Then build the bindings and run tests with:

just test-py

Metadata

Release files for rten 0.29.0a1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for rten 0.29.0a1
File Size Uploaded Provenance Actions
rten-0.29.0a1.tar.gz 938.7 kB Without provenance Details for rten-0.29.0a1.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for rten 0.29.0a1
File Interpreter ABI Platform Actions
rten-0.29.0a1-cp312-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.12 abi3 Linux glibc 2.17+ x86-64 Details for rten-0.29.0a1-cp312-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
rten-0.29.0a1-cp312-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl CPython 3.12 abi3 Linux glibc 2.17+ ARM64 Details for rten-0.29.0a1-cp312-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
rten-0.29.0a1-cp312-abi3-macosx_11_0_arm64.whl CPython 3.12 abi3 macOS 11.0+ ARM64 Details for rten-0.29.0a1-cp312-abi3-macosx_11_0_arm64.whl

Total release size: 7.6 MB

Release files / rten-0.29.0a1.tar.gz

Download URL rten-0.29.0a1.tar.gz
Size 938.7 kB
Tags Source
SHA-256 checksum
How to use checksums
cfa40601dabc95e4bd56cef5f2290b8acd2d86075c56454957d50adfc9649544
BLAKE2b-256 checksum
How to use checksums
9c14cbd72ea036da5ad645071d913a9b02b41eab721696bd5993f9ec5df5a09b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.16

Release files / rten-0.29.0a1-cp312-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL rten-0.29.0a1-cp312-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 2.4 MB
Tags CPython 3.12 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
309c0d02b39c1be0804a65bec7001be4919fbf91790d0c5884656029fe595c9c
BLAKE2b-256 checksum
How to use checksums
dafc3b55ce60f49e50e3a77caa7a424c6a7934fc79d18830dfe80110c34cc63d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.16

Release files / rten-0.29.0a1-cp312-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Download URL rten-0.29.0a1-cp312-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 2.2 MB
Tags CPython 3.12 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
b463765227e8bd81c5b8e9794fa35be136d458b3c98174fb8718701c8b94dd75
BLAKE2b-256 checksum
How to use checksums
fd1fd6f56069a21a50af241c8e232e16c52f313906527b4924bbb8d533f53936
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.16

Release files / rten-0.29.0a1-cp312-abi3-macosx_11_0_arm64.whl

Download URL rten-0.29.0a1-cp312-abi3-macosx_11_0_arm64.whl
Size 2.0 MB
Tags CPython 3.12 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
a2e9240686869a7e7a5715cfcf3f675548b91f8ccb3b6b141312faa1490b5f13
BLAKE2b-256 checksum
How to use checksums
09f157e8cbc48bb091b828ec699683da938c378f217a0e4292c6486d2cd77128
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.16

Security for rten 0.29.0a1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page