#9898th of 171 in Learning and cookbooks

pytorch-cpp

C++ LibTorch ports of the PyTorch tutorials, from basics to GANs

Run it:Vast.ai ↗ (opens in a new tab)Clore.ai ↗ (opens in a new tab)Affiliate links, no effect on a rank.

Stars
2.1k
License
MIT
Last commit
Nov 2026
Last release
Sep 2026
Language
C++
Stars, last 30 weeks+26
28 Apr 2026: 2,113 stars5 May 2026: 2,114 stars12 May 2026: 2,116 stars19 May 2026: 2,116 stars26 May 2026: 2,117 stars2 Jun 2026: 2,118 stars9 Jun 2026: 2,121 stars16 Jun 2026: 2,121 stars23 Jun 2026: 2,121 stars30 Jun 2026: 2,122 stars7 Jul 2026: 2,123 stars14 Jul 2026: 2,124 stars21 Jul 2026: 2,124 stars28 Jul 2026: 2,126 stars4 Aug 2026: 2,126 stars11 Aug 2026: 2,126 stars18 Aug 2026: 2,126 stars25 Aug 2026: 2,126 stars1 Sept 2026: 2,126 stars8 Sept 2026: 2,127 stars15 Sept 2026: 2,128 stars22 Sept 2026: 2,130 stars29 Sept 2026: 2,131 stars6 Oct 2026: 2,132 stars13 Oct 2026: 2,135 stars20 Oct 2026: 2,137 stars27 Oct 2026: 2,137 stars3 Nov 2026: 2,138 stars10 Nov 2026: 2,138 stars17 Nov 2026: 2,138 stars24 Nov 2026: 2,139 stars

2,113 on 28 Apr 20262,139 on 24 Nov 2026

From GitHub's daily star counts.

Checked on GitHub.

Overview

C++17 port of the yunjey/pytorch-tutorial examples using LibTorch. It covers basics (linear and logistic regression, feedforward nets), intermediate (CNN, ResNet, RNN, RNN-LM) and advanced topics (GAN, VAE, style transfer, image captioning), plus the 60 Minute Blitz. Each tutorial builds as its own CMake target, and a CPU Docker setup and a Colab notebook are provided.

Who it is for: C++ developers learning deep learning through the LibTorch API

Strengths

  • Covers 14 tutorials from tensor basics to image captioning, each a separate CMake target
  • CMake can download LibTorch for a chosen CUDA version (11.8 to 13.2) or CPU
  • CI builds on macOS, Linux (gcc 14, 16) and Windows (msvc 2025)
  • Dockerfile and docker-compose for CPU builds, plus a Colab notebook

Weaknesses

  • Tutorials must be run from their build directory, or paths to data and models break
  • Tied to LibTorch 1.12.0 to 2.14.0; interactive notebooks use nightly and may break
  • Some tutorials need Python with PyTorch and torchvision to generate scriptmodule weights
  • Docker image is CPU only

What it needs

  • GPU optional
  • Docker + Compose
  • Needs LibTorch 1.12.0-2.14.0, CMake 3.28.6+, C++17 compiler, Conda (interactive notebooks)
  • Models: LibTorch scriptmodule

What changed

From the release notes. No flag means the note does not say so, not that the upgrade is safe. Releases and problems by RSS

Also in Learning and cookbooks

See all 171
Also in Learning and cookbooks
RankProjectScore
#96asl-ml-immersionGoogle Cloud ML course notebooks covering TensorFlow, MLOps and Gemini agents2.6k starsApache-2.046 out of 100
#97agents-from-scratchLangGraph tutorial notebooks that build an email-triage and reply agent2.5k starsMIT46 out of 100
#99prompt-engineering-guideWritten guide to prompt engineering techniques, with papers, notebooks and example prompts80.4k stars+914 (+1.1%) in 30 daysMIT45 out of 100
#100handson-mlJupyter notebooks for the first edition of Hands-on Machine Learning book Live demo ↗ (opens in a new tab)25.6k starsApache-2.045 out of 100
#101machine_learning_examplesPython code for Lazy Programmer's online machine learning courses9k starsno license45 out of 100