# LaurentMazare/tch-rs

Rust bindings for the C++ api of PyTorch.

Repository: https://github.com/LaurentMazare/tch-rs
Canonical: https://ross.abutalabs.com/products/tch-rs
Language: Rust
License: Apache-2.0
License Family: permissive
Topics: pytorch, rust, machine-learning, neural-network, deep-learning
Last push: 2026-08-23T16:46:54+00:00

## Health v2 (maintenance only)
Score: 67/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 99, release rhythm 8, longevity 100
- inputs: {"age_days": 2755, "days_push": 10, "days_rel": null, "gap_med": null, "n_releases_24m": 0}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 5479, forks 447 (observed 2026-08-28T04:09:19.705546+00:00)

## What it is
tch-rs is a Rust crate providing thin bindings to the C++ API of PyTorch (libtorch), staying close to the original API. It enables tensor operations and neural network training/inference in Rust with optional CUDA support.

## Use cases
- train neural networks in rust
- run pytorch models from rust
- tensor computations in rust
- deep learning inference without python
- gpu-accelerated machine learning in rust
- port pytorch code to rust

## When to choose
- you want PyTorch's tensor and autograd capabilities in a Rust program
- you need to deploy models in Rust without a Python runtime
- you want low-level, close-to-libtorch control

## When to avoid
- you want highly idiomatic Rust ML APIs rather than C++-style bindings
- you need a pure-Rust implementation without libtorch dependencies
- you primarily work in Python

## Facets
- artifact type: library
- maturity: active
- function: machine-learning, deep-learning, llm-training, gpu-computing
- domain: machine-learning, deep-learning, artificial-intelligence
- platform: rust, windows
- tags: pytorch, libtorch, tensors, neural-networks, bindings, linux, macos, gpu

## Member repositories
- LaurentMazare/tch-rs (main) score 67

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:09:19.705546+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-29T17:56:42.112012+00:00, confidence not recorded.
  - readme: https://github.com/LaurentMazare/tch-rs (fetched 2026-08-28T04:09:19.705546+00:00, sha c0cefe92a992)
- Data as of 2026-08-30T08:39:29.467469+00:00.
