PyTorch is officially binded with Rust (tch-rs)

The rust community has grown so much over the years, a library ‘tch-rs’ ( has had a successful build ( to bind C++ API of PyTorch.

I am posting this to have the PyTorch community expand and self aware if anyone else has experience with rust and open to hear if anyone has tried to deploy PyTorch algorithms with tch-rs.


what is the benefit for binding with rust language ?

1 Like

Right now Libtorch C++ API deployment is somewhat difficult unless you have an open source library/software (i.e. torchserve) than can wrap serialize model’s into production instead of python web frameworks (flask/django/fastapi). Torchserve is nice for it has an RFC for a high performance Cpp PyTorch serving platform

If you look at the techempower benchmarks, you see in the top 10 we have 4/10 libraries made in rust. This site is used to measure who has the fastest request done for web frameworks.

Right now two popular web frameworks from rust, Rocket and Actix, are gaining traction in the web community. Once you finish creating your algorithms in pytorch using pytorch library, torchscript the model to be loaded up using tch-rs.