#pytorch #deep-learning #machine-learning #wrapper

aotinductor

Rust wrappers for the PyTorch AOTInductor api

3 releases

0.1.2 Feb 5, 2025
0.1.1 Feb 5, 2025
0.1.0 Feb 5, 2025

#360 in Machine learning

Download history 383/week @ 2025-02-05 15/week @ 2025-02-12 24/week @ 2025-02-19 39/week @ 2025-02-26

461 downloads per month

Custom license

255KB
112 lines

Contains (Zip file, 355KB) tests/ep2.pt2, (Zip file, 355KB) tests/ep1.pt2

Build Latest Documentation

aotinductor-rs

Rust bindings for pytorch AOTInductor.

Build

This crate requires the libtorch in the same version as tch-rs. You need to set the environment variable LIBTORCH to the path to folder of the library.

  • If you are using pytorch, then the path is in the site-packages folder: .../lib/python3.xx/site-packages/torch/
  • If you have downloaded a libtorch, then the path is where you unpackaged the library.

Getting Started

use aotinductor::ModelPackage;
use tch::Tensor;

if let Some(model) = ModelPackage::new("path/to/some.pt2") {
    let inp1 = Tensor::rand([1, 2], (tch::Kind::Float, tch::Device::Cpu));
    let inp2 = Tensor::rand([1, 4], (tch::Kind::Float, tch::Device::Cpu));
    let out: std::vec::Vec<Tensor> = loader.run(&vec![inp1, inp2]);
};

Dependencies

~14MB
~274K SLoC