2 releases

0.1.1 Mar 21, 2024
0.1.0 Mar 9, 2024

#907 in Machine learning

Download history 122/week @ 2024-03-18 39/week @ 2024-04-01 16/week @ 2024-04-29

70 downloads per month




Libtorch backend for zyx machine learning library.

Libtorch backend uses libtorch c++ library for executing graph.

This backend needs to have access to libtorch c++ library. zyx-torch uses tch-rs library as it's backend, therefore following methods can be used to install libtorch:

LibTorch can be downloaded directly from pytorch website. Select stable, your OS, LibTorch and your preferred compute platform. Download cxx11 ABI. Once downloaded, extract the archive to some folder. Then run following commands and replace /path/to/libtorch with folder where you extracted libtorch. Use absolute path. This sets necessary environment variables for libtorch. Note that environment variables get reset when you reboot your computer, so you need to reexport them again, or put them into some script that runs automatically.

export LIBTORCH=/path/to/libtorch

Please read pytorch documentation for all prerequisities, you may need to install c++ compiler or gpu drivers.

If you have pytorch installed, the above environment variables will interfere with it. In that case, you may prefer to use pytorch's libtorch,


If neither of those options works for you, zyx-torch can install libtorch automatically, by enabling download-libtorch feature.

For README and source code, please visit github.

For more details, there is a book.

Cargo features

  • std - enables zyx-core/std
  • download-libtorch - installs libtorch


~247K SLoC