PyTorch Examples¶
This pages lists various PyTorch examples that you can use to learn and experiment with PyTorch.
Image Classification Using ConvNets
This example demonstrates how to run image classification with Convolutional Neural Networks ConvNets on the MNIST database.
Measuring Similarity using Siamese Network
This example demonstrates how to measure similarity between two images using Siamese network on the MNIST database.
Word-level Language Modeling using RNN and Transformer
This example demonstrates how to train a multi-layer recurrent neural network (RNN), such as Elman, GRU, or LSTM, or Transformer on a language modeling task by using the Wikitext-2 dataset.
Generative Adversarial Networks (DCGAN)
This example implements the Unsupervised Representation Learning with Deep Convolutional Generative Adversarial Networks paper.
Variational Auto-Encoders
This example implements the Auto-Encoding Variational Bayes paper with ReLUs and the Adam optimizer.
Super-resolution Using an Efficient Sub-Pixel CNN
This example demonstrates how to use the sub-pixel convolution layer described in Real-Time Single Image and Video Super-Resolution Using an Efficient Sub-Pixel Convolutional Neural Network paper. This example trains a super-resolution network on the BSD300 dataset.
HOGWILD! Training of Shared ConvNets
HOGWILD! is a scheme that allows Stochastic Gradient Descent (SGD) parallelization without memory locking. This example demonstrates how to perform HOGWILD! training of shared ConvNets on MNIST.
Training a CartPole to balance in OpenAI Gym with actor-critic
This reinforcement learning tutorial demonstrates how to train a CartPole to balance in the OpenAI Gym toolkit by using the Actor-Critic method.
Time Sequence Prediction
This beginner example demonstrates how to use LSTMCell to learn sine wave signals to predict the signal values in the future.
Implement the Neural Style Transfer algorithm on images
This tutorial demonstrates how you can use PyTorch’s implementation of the Neural Style Transfer (NST) algorithm on images.
PyTorch Module Transformations using fx
This set of examples demonstrates the torch.fx toolkit. For more information about torch.fx, see torch.fx Overview.
Distributed PyTorch
This set of examples demonstrates Distributed Data Parallel (DDP) and Distributed RPC framework. Includes the code used in the DDP tutorial series.
C++ Frontend
The PyTorch C++ frontend is a C++14 library for CPU and GPU tensor computation. This set of examples includes a linear regression, autograd, image recognition (MNIST), and other useful examples using PyTorch C++ frontend.
Image Classification Using Forward-Forward Algorithm
This example implements the paper The Forward-Forward Algorithm: Some Preliminary Investigations by Geoffrey Hinton. on the MNIST database. It is an introductory example to the Forward-Forward algorithm.
Graph Convolutional Network
This example implements the Semi-Supervised Classification with Graph Convolutional Networks paper on the CORA database.