Need help with tutorials?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

5.4K Stars 3.0K Forks BSD 3-Clause "New" or "Revised" License 1.7K Commits 182 Opened issues


PyTorch tutorials.

Services available


Need anything else?

Contributors list

PyTorch Tutorials

All the tutorials are now presented as sphinx style documentation at:


We use sphinx-gallery's notebook styled examples to create the tutorials. Syntax is very simple. In essence, you write a slightly well formatted python file and it shows up as documentation page.

Here's how to create a new tutorial or recipe: 1. Create a notebook styled python file. If you want it executed while inserted into documentation, save the file with suffix

so that file name is
. 2. Put it in one of the beginnersource, intermediatesource, advancedsource based on the level. If it is a recipe, add to recipessource. 2. For Tutorials (except if it is a prototype feature), include it in the TOC tree at index.rst 3. For Tutorials (except if it is a prototype feature), create a thumbnail in the index.rst file using a command like
.. customcarditem:: beginner/your_tutorial.html
. For Recipes, create a thumbnail in the recipes_index.rst

In case you prefer to write your tutorial in jupyter, you can use this script to convert the notebook to python file. After conversion and addition to the project, please make sure the sections headings etc are in logical order.


  • Start with installing torch, torchvision, and your GPUs latest drivers. Install other requirements using
    pip install -r requirements.txt

If you want to use

, make your environment in a
directory like:
virtualenv ./venv
, then
source ./venv/bin/activate
  • Then you can build using
    make docs
    . This will download the data, execute the tutorials and build the documentation to
    directory. This will take about 60-120 min for systems with GPUs. If you do not have a GPU installed on your system, then see next step.
  • You can skip the computationally intensive graph generation by running
    make html-noplot
    to build basic html documentation to
    . This way, you can quickly preview your tutorial.

If you get ModuleNotFoundError: No module named 'pytorchsphinxtheme' make: *** [html-noplot] Error 2 from /tutorials/src/pytorch-sphinx-theme or /venv/src/pytorch-sphinx-theme (while using virtualenv), run

python install

About contributing to PyTorch Documentation and Tutorials

  • You can find information about contributing to PyTorch documentation in the PyTorch Repo file.
  • Additional information can be found in PyTorch

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.