C++ Implementation of PyTorch Tutorials for Everyone

OS (Compiler)\LibTorch 1.9.0
macOS (clang 10.0, 11.0, 12.0) Status
Linux (gcc 8, 9, 10, 11) Status
Windows (msvc 2017, 2019) Status

Table of Contents

This repository provides tutorial code in C++ for deep learning researchers to learn PyTorch (i.e. Section 1 to 3)
Python Tutorial: https://github.com/yunjey/pytorch-tutorial

1. Basics

2. Intermediate

3. Advanced

4. Interactive Tutorials

5. Other Popular Tutorials

Getting Started

Requirements

  1. C++
  2. CMake (minimum version 3.14)
  3. LibTorch v1.9.0
  4. Conda

For Interactive Tutorials

Note: Interactive Tutorials are currently running on LibTorch Nightly Version.
So there are some tutorials which can break when working with nightly version.

conda create --name pytorch-cpp
conda activate pytorch-cpp
conda install xeus-cling notebook -c conda-forge

Clone, build and run tutorials

In Google Colab

Open In Colab

On Local Machine

git clone https://github.com/prabhuomkar/pytorch-cpp.git
cd pytorch-cpp

Generate build system

<div class="highlight highlight-source-shell position-relative" data-snippet-clipboard-copy-content="cmake -B build #
“>

cmake -B build #<options>