pytorch-cpp
C++ Implementation of PyTorch Tutorials for Everyone
What is pytorch-cpp?
C++ Implementation of PyTorch Tutorials for Everyone
Overview of pytorch-cpp
What it is
pytorch-cpp is a C++ implementation of PyTorch tutorials. It provides tutorial code in C++ for deep learning researchers to learn PyTorch, covering sections 1 to 3 of the original Python tutorial. The repository is hosted at https://github.com/prabhuomkar/pytorch-cpp and is categorized under AI.
Key features
- C++ implementation of PyTorch tutorials originally written in Python.
- Covers Basics, Intermediate, and Advanced topics including convolutional neural networks, recurrent neural networks, generative adversarial networks, and neural style transfer.
- Supports building all tutorials, tutorials by category (basics, intermediate, advanced, popular), or individual tutorials.
- Provides Docker support for building and running tutorials on CPU.
- Allows automatic download of LibTorch (CPU or CUDA versions) and required datasets during build.
- Supports creation of scriptmodule files for prelearned models/weights using an existing Python installation with PyTorch and torchvision.
Use cases
Deep learning researchers who want to learn PyTorch using C++ instead of Python. Developers who need to integrate PyTorch models into C++ applications. Anyone following the original PyTorch Python tutorial but preferring to work in C++.
Getting started
Requirements: C++-17 compatible compiler, CMake (minimum version 3.28.6), LibTorch version >= 1.12.0. Example Linux command to configure with existing Python and PyTorch:bashcmake -B build -D CMAKE_BUILD_TYPE=Release -D CMAKE_PREFIX_PATH=/path/to/libtorch/share/cmake/Torch -D CREATE_SCRIPTMODULES=ONExample Windows command to automatically download LibTorch for CUDA 11.8:bashcmake -B build -A x64 -D CUDA_V=11.8Build all tutorials:bashcmake --build buildFor detailed instructions on building specific tutorials and running them, see the repository README.
License and pricing
This repository is licensed under MIT as given in LICENSE. It is open source with no stated pricing.
Based on the project's public README and repository metadata.