PyTorch Recipes

Recipes are bite-sized bite-sized, actionable examples of how to use specific PyTorch features, different from our full-length tutorials.

Loading data in PyTorch

Learn how to use PyTorch packages to prepare and load common datasets for your model.


Defining a Neural Network

Learn how to use PyTorch's torch.nn package to create and define a neural network the MNIST dataset.


What is a state_dict in PyTorch

Learn how state_dict objects, Python dictionaries, are used in saving or loading models from PyTorch.


PyTorch에서 추론(inference)을 위해 모델 저장하기 & 불러오기

PyTorch에서 추론을 위해 모델을 저장하고 불러오는 두 가지 접근 방식(state_dict 및 전체 모델)을 알아봅니다.


Saving and loading a general checkpoint in PyTorch

Saving and loading a general checkpoint model for inference or resuming training can be helpful for picking up where you last left off. In this recipe, explore how to save and load multiple checkpoints.


Saving and loading multiple models in one file using PyTorch

In this recipe, learn how saving and loading multiple models can be helpful for reusing models that you have previously trained.


Warmstarting model using parameters from a different model in PyTorch

Learn how warmstarting the training process by partially loading a model or loading a partial model can help your model converge much faster than training from scratch.


Saving and loading models across devices in PyTorch

Learn how saving and loading models across devices (CPUs and GPUs) is relatively straightforward using PyTorch.


Zeroing out gradients in PyTorch

Learn when you should zero out graidents and how doing so can help increase the accuracy of your model.


Custom Datasets, Transforms & Dataloaders

Learn how to leverage the PyTorch dataset API to easily create a custom dataset and custom dataloader.


Model Interpretability using Captum

Learn how to use Captum attribute the predictions of an image classifier to their corresponding image features and visualize the attribution results.


How to use TensorBoard with PyTorch

Learn basic usage of TensorBoard with PyTorch, and how to visualize data in TensorBoard UI


Dynamic Quantization

Apply dynamic quantization to a simple LSTM model.


TorchScript for Deployment

Learn how to export your trained model in TorchScript format and how to load your TorchScript model in C++ and do inference.


Flask로 배포하기

경량 웹서버 Flask를 사용하여 학습된 PyTorch Model을 Web API로 빠르게 만드는 방법을 알아봅니다.



Access comprehensive developer documentation for PyTorch

View Docs


Get in-depth tutorials for beginners and advanced developers

View Tutorials


Find development resources and get your questions answered

View Resources