# pytorch/examples

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/pytorch-examples).**

23,752 stars · 9,794 forks · Python · bsd-3-clause

## Links

- GitHub: https://github.com/pytorch/examples
- Homepage: https://pytorch.org/examples
- awesome-repositories: https://awesome-repositories.com/repository/pytorch-examples.md

## Description

This repository serves as a comprehensive collection of reference implementations for the PyTorch machine learning library. It provides practical examples for building, training, and deploying deep learning models, functioning as a toolkit for developers to explore neural network architectures and training workflows.

The project distinguishes itself by offering concrete demonstrations of complex machine learning operations, ranging from computer vision tasks like object detection and depth estimation to the training of large-scale transformer models. These examples illustrate how to implement and optimize neural networks, providing a bridge between theoretical model design and functional code.

The collection covers a broad capability surface, including techniques for distributed training, model optimization, and deployment across diverse hardware environments. It demonstrates how to manage data pipelines, configure model parameters, and utilize pre-trained architectures for various inference tasks.

The repository is maintained as a primary educational resource for the PyTorch community, offering documented code that serves as a foundation for both research and production-grade machine learning development.

## Tags

### Artificial Intelligence & ML

- [Machine Learning Implementations](https://awesome-repositories.com/f/artificial-intelligence-ml/machine-learning-implementations.md) — Provides a collection of reference implementations demonstrating how to build, train, and deploy deep learning models.
- [Python Machine Learning Libraries](https://awesome-repositories.com/f/artificial-intelligence-ml/python-machine-learning-libraries.md) — Provides a comprehensive collection of reference implementations for building, training, and deploying deep learning models using the PyTorch framework.
- [Deep Learning Frameworks](https://awesome-repositories.com/f/artificial-intelligence-ml/deep-learning-frameworks.md) — Provides a library for building and training neural networks with support for automatic differentiation and hardware acceleration.
- [Large Language Model Training Frameworks](https://awesome-repositories.com/f/artificial-intelligence-ml/machine-learning/infrastructure/model-training-and-tuning/training-frameworks/large-language-model-training-frameworks.md) — Implements optimized training frameworks for large-scale transformer models to improve natural language understanding. ([source](https://pytorch.org/blog/lf-model-type/nlp/))
- [Computer Vision Models](https://awesome-repositories.com/f/artificial-intelligence-ml/computer-vision-models.md) — Serves as a repository of neural network architectures designed for image classification, object detection, and feature extraction.
- [Image Classification Models](https://awesome-repositories.com/f/artificial-intelligence-ml/computer-vision-systems/computer-vision/image-classification-models.md) — Demonstrates the use of pre-trained neural networks to perform image classification tasks. ([source](https://pytorch.org/hub/pytorch_vision_alexnet/))
- [Distributed Training](https://awesome-repositories.com/f/artificial-intelligence-ml/distributed-training.md) — Distributes model training across multiple hardware nodes to reduce total training time for large-scale tasks. ([source](https://pytorch.org/blog/category/ecosystem/))
- [Large Scale Training](https://awesome-repositories.com/f/artificial-intelligence-ml/large-scale-training.md) — Distributes the training of massive neural networks across multiple compute nodes to manage memory and time requirements. ([source](https://pytorch.org/blog/tag/nlp/))
- [Model Training Toolkits](https://awesome-repositories.com/f/artificial-intelligence-ml/model-training-toolkits.md) — Provides frameworks and utilities for pretraining, fine-tuning, and aligning large-scale neural network models.
- [Neural Network Toolkits](https://awesome-repositories.com/f/artificial-intelligence-ml/neural-network-research/neural-network-toolkits.md) — Provides research-oriented toolkits for building, training, and evaluating neural networks.
- [Automatic Differentiation Engines](https://awesome-repositories.com/f/artificial-intelligence-ml/automatic-differentiation-engines.md) — Provides a core engine for tracking tensor operations and computing gradients dynamically during neural network training.
- [Object Detection](https://awesome-repositories.com/f/artificial-intelligence-ml/computer-vision-systems/computer-vision/object-detection-tracking/object-detection.md) — Implements object detection systems to identify and localize multiple objects within images using neural networks. ([source](https://pytorch.org/hub/nvidia_deeplearningexamples_ssd/))
- [Monocular Depth Estimators](https://awesome-repositories.com/f/artificial-intelligence-ml/computer-vision-systems/computer-vision/object-pose-estimations/monocular-depth-estimators.md) — Calculates the distance of objects from a camera using a single image input to reconstruct three-dimensional spatial information from two-dimensional data. ([source](https://pytorch.org/blog/tag/research/))
- [Distributed Training](https://awesome-repositories.com/f/artificial-intelligence-ml/distributed-training-frameworks/distributed-training.md) — Provides tools for configuring data and model parallelism to train large neural networks across multiple devices. ([source](https://pytorch.org/newsletter/march-2026/))
- [Convolutional Classifiers](https://awesome-repositories.com/f/artificial-intelligence-ml/image-classification/transformer-based-image-classifiers/convolutional-classifiers.md) — Provides reference implementations for image classification using densely connected convolutional networks. ([source](https://pytorch.org/hub/pytorch_vision_densenet/))
- [Generative Adversarial Architectures](https://awesome-repositories.com/f/artificial-intelligence-ml/image-generation/generative-adversarial-architectures.md) — Trains generative adversarial networks to produce high-resolution images through incremental resolution scaling. ([source](https://pytorch.org/blog/lf-model-type/generative/))
- [Inference Accelerators](https://awesome-repositories.com/f/artificial-intelligence-ml/inference-accelerators.md) — Executes optimized compute kernels for quantization and matrix multiplication to accelerate model predictions. ([source](https://pytorch.org/blog/portable-vllm-model-inference-kernels-in-helion/))
- [Language Model Fine-Tuning](https://awesome-repositories.com/f/artificial-intelligence-ml/language-model-fine-tuning.md) — Demonstrates practical workflows for training and fine-tuning large-scale transformer architectures and sequence-based models.
- [Model Compilation](https://awesome-repositories.com/f/artificial-intelligence-ml/machine-learning/infrastructure/model-optimization-and-inference/serving-and-runtime/inference-optimization-utilities/model-compilation.md) — Converts trained neural network models into optimized formats for efficient inference on specialized hardware. ([source](https://pytorch.org/blog/tag/media-entertainment/))
- [Inference Optimizations](https://awesome-repositories.com/f/artificial-intelligence-ml/machine-learning/infrastructure/model-optimization-and-inference/serving-and-runtime/inference-optimizations.md) — Provides techniques and mechanisms to reduce latency and increase throughput during the model inference phase. ([source](https://pytorch.org/blog/pytorch-meetup-singapore-a-milestone-in-apac/))
- [Model Training Pipelines](https://awesome-repositories.com/f/artificial-intelligence-ml/machine-learning/infrastructure/model-training-and-tuning/training-frameworks/model-training-pipelines.md) — Implements end-to-end workflows and scripts for sourcing datasets, training models, and validating performance.
- [Language Model Initializers](https://awesome-repositories.com/f/artificial-intelligence-ml/machine-learning/model-fine-tuning-adaptation/language-model-training/language-model-initializers.md) — Initializes advanced transformer architectures with pretrained weights for language modeling and sequence tasks. ([source](https://pytorch.org/hub/huggingface_pytorch-transformers/))
- [Model Performance Optimization](https://awesome-repositories.com/f/artificial-intelligence-ml/model-optimization/profiling-and-benchmarking/model-performance-optimization.md) — Applies compiler-level optimizations to reshape model graphs and improve execution speed. ([source](https://pytorch.org/blog/pytorch-meetup-singapore-a-milestone-in-apac/))
- [Model Training Optimizers](https://awesome-repositories.com/f/artificial-intelligence-ml/model-training-optimizers.md) — Offers utilities and configurations for accelerating the training convergence and performance of machine learning models. ([source](https://pytorch.org/blog/using-muon-optimizer-with-deepspeed/))
- [Distributed Training Orchestration](https://awesome-repositories.com/f/artificial-intelligence-ml/distributed-training-orchestration.md) — Manages the orchestration of distributed training workloads to scale model parameter updates across clusters.
- [Inference Scaling](https://awesome-repositories.com/f/artificial-intelligence-ml/inference-scaling.md) — Orchestrates high-performance model execution across distributed clusters to deploy inference at scale. ([source](https://pytorch.org/blog/tag/medical/))
- [Kernel Optimizers](https://awesome-repositories.com/f/artificial-intelligence-ml/kernel-optimizers.md) — Automates the generation and tuning of hardware-specific compute kernels to improve performance. ([source](https://pytorch.org/newsletter/march-2026/))
- [Edge AI Model Deployment](https://awesome-repositories.com/f/artificial-intelligence-ml/machine-learning/infrastructure/model-deployment-and-serving/local-and-on-device-inference/edge-ai-model-deployment.md) — Optimizes and deploys models for efficient execution on edge devices and local hardware. ([source](https://pytorch.org/blog/category/announcements/))
- [Performance Benchmarks](https://awesome-repositories.com/f/artificial-intelligence-ml/machine-learning/infrastructure/model-evaluation-and-validation/performance-benchmarks.md) — Measures end-to-end model latency and throughput to identify performance bottlenecks in inference pipelines. ([source](https://pytorch.org/blog/portable-vllm-model-inference-kernels-in-helion/))
- [Machine Learning Optimization](https://awesome-repositories.com/f/artificial-intelligence-ml/machine-learning/infrastructure/model-optimization-and-inference/training-algorithms/machine-learning-optimization.md) — Provides general strategies and resources for improving the efficiency and resource utilization of machine learning workflows.
- [Model Loading](https://awesome-repositories.com/f/artificial-intelligence-ml/machine-learning/infrastructure/model-training-and-tuning/data-and-checkpointing/model-loading.md) — Provides utilities for saving and loading model states to facilitate reuse and deployment. ([source](https://pytorch.org/hub/huggingface_pytorch-transformers/))
- [Model Graph Optimizers](https://awesome-repositories.com/f/artificial-intelligence-ml/model-graph-optimizers.md) — Optimizes model graphs by compiling them into static execution structures for reduced latency.
- [Model Quantization](https://awesome-repositories.com/f/artificial-intelligence-ml/model-quantization.md) — Reduces model parameter precision to decrease memory footprint and accelerate execution on resource-constrained hardware.
- [Natural Language Processing](https://awesome-repositories.com/f/artificial-intelligence-ml/natural-language-processing.md) — Converts raw text into numerical sequences compatible with transformer architectures for downstream processing. ([source](https://pytorch.org/hub/huggingface_pytorch-transformers/))
- [Static Graph Compilers](https://awesome-repositories.com/f/artificial-intelligence-ml/static-graph-compilers.md) — Compiles high-level neural network definitions into static execution graphs to improve inference speed.
- [Distributed Training Scaling Utilities](https://awesome-repositories.com/f/artificial-intelligence-ml/distributed-training-scaling-utilities.md) — Provides tools for managing and scaling training workloads across distributed systems.
- [Kernel Fusion Compilers](https://awesome-repositories.com/f/artificial-intelligence-ml/kernel-fusion-compilers.md) — Combines sequential mathematical operations into single optimized kernels to minimize memory overhead and maximize throughput.
- [Training Acceleration Tools](https://awesome-repositories.com/f/artificial-intelligence-ml/machine-learning/infrastructure/machine-learning-training/distributed-and-accelerated-compute/training-acceleration-tools.md) — Optimizes memory usage and data throughput for complex multimodal model architectures. ([source](https://pytorch.org/newsletter/march-2026/))
- [High-Throughput Model Serving](https://awesome-repositories.com/f/artificial-intelligence-ml/machine-learning/infrastructure/model-deployment-and-serving/inference-servers-and-runtimes/high-throughput-model-serving.md) — Provides architectures designed to handle large volumes of concurrent inference requests with low latency. ([source](https://pytorch.org/blog/pytorch-meetup-singapore-a-milestone-in-apac/))
- [Multi-Modal Input Processors](https://awesome-repositories.com/f/artificial-intelligence-ml/machine-learning/multimodal-processing-tools/multi-modal-input-processors.md) — Processes diverse data types like images, video, and text through a unified interface for multi-modal inference. ([source](https://pytorch.org/blog/pytorch-meetup-singapore-a-milestone-in-apac/))
- [Model Optimization](https://awesome-repositories.com/f/artificial-intelligence-ml/model-optimization.md) — Simplifies neural network structures to achieve higher performance and efficiency compared to complex designs. ([source](https://pytorch.org/blog/lf-model-type/scriptable/))
- [Lightweight Model Implementations](https://awesome-repositories.com/f/artificial-intelligence-ml/neural-network-implementations/lightweight-model-implementations.md) — Constructs streamlined neural network models that maintain high performance with lower computational complexity. ([source](https://pytorch.org/blog/lf-model-type/vision/))
- [Tensor Reductions](https://awesome-repositories.com/f/artificial-intelligence-ml/tensor-reductions.md) — Integrates reduction calculations with surrounding operations to optimize memory access during batch processing. ([source](https://pytorch.org/blog/why-is-pytorch-compile-so-fast-kernel-fusion/))
- [Hardware Acceleration Kernels](https://awesome-repositories.com/f/artificial-intelligence-ml/hardware-acceleration-kernels.md) — Provides optimized computational kernels that leverage hardware-specific instructions for high-performance execution.
- [Hardware Dispatchers](https://awesome-repositories.com/f/artificial-intelligence-ml/hardware-acceleration-kernels/hardware-dispatchers.md) — Selects and executes specialized compute kernels at runtime to ensure optimal performance across diverse processing units.
- [Inference Optimization Kernels](https://awesome-repositories.com/f/artificial-intelligence-ml/inference-optimization-kernels.md) — Registers and selects specialized compute kernels at runtime to optimize execution paths for inference. ([source](https://pytorch.org/blog/portable-vllm-model-inference-kernels-in-helion/))
- [Object Detection Models](https://awesome-repositories.com/f/artificial-intelligence-ml/machine-learning/architectures/computer-vision-segmentation-models/object-detection-models.md) — Demonstrates loading pretrained detection models to perform object detection tasks without training from scratch. ([source](https://pytorch.org/hub/nvidia_deeplearningexamples_ssd/))
- [Request Routing & Gateways](https://awesome-repositories.com/f/artificial-intelligence-ml/machine-learning/infrastructure/model-inference-serving/request-routing-gateways.md) — Routes inference requests through a modular gateway that supports custom logic for authentication and model selection.
- [Matrix Operation Fusions](https://awesome-repositories.com/f/artificial-intelligence-ml/matrix-operation-fusions.md) — Append simple mathematical operations directly to the output of matrix multiplications to avoid writing and re-reading intermediate results from memory. ([source](https://pytorch.org/blog/why-is-pytorch-compile-so-fast-kernel-fusion/))
- [Model Configuration](https://awesome-repositories.com/f/artificial-intelligence-ml/model-configuration.md) — Provides interfaces for configuring model parameters like layer counts and hidden states to customize behavior. ([source](https://pytorch.org/hub/huggingface_pytorch-transformers/))
- [Model Routing Layers](https://awesome-repositories.com/f/artificial-intelligence-ml/model-routing-layers.md) — Aggregates multiple inference engines into a unified gateway to simplify request routing across various models. ([source](https://pytorch.org/blog/lightseek-smg/))
- [Multimodal Processing](https://awesome-repositories.com/f/artificial-intelligence-ml/multimodal-processing.md) — Executes high-performance tensor transformations to process multimodal data for inference engines. ([source](https://pytorch.org/blog/lightseek-smg/))

### Education & Learning Resources

- [Deep Learning Reference Implementations](https://awesome-repositories.com/f/education-learning-resources/technical-domain-education/ai-machine-learning-education/deep-learning-reference-implementations.md) — Offers curated code examples demonstrating best practices for constructing, training, and deploying neural networks.
- [Technical Tutorials](https://awesome-repositories.com/f/education-learning-resources/educational-resources/reference-and-media/tutorials-media-curated-lists/technical-tutorials.md) — Offers structured guides and instructional content designed to teach specific technical concepts and development workflows. ([source](https://pytorch.org/venue/the-limelight-boulder/))

### Data & Databases

- [Collective Communication Operations](https://awesome-repositories.com/f/data-databases/collective-communication-operations.md) — Implements collective communication operations to synchronize parameters and data across distributed compute nodes.
- [Data Pipelines](https://awesome-repositories.com/f/data-databases/data-pipelines.md) — Streams multi-modal data through high-performance tensor-based pipelines directly into execution engines.
- [Preprocessing Fusions](https://awesome-repositories.com/f/data-databases/batch-processing/batch-matrix-multiplication-utilities/preprocessing-fusions.md) — Perform preprocessing tasks like data normalization as information is loaded into memory before passing it directly to matrix multiplication kernels. ([source](https://pytorch.org/blog/why-is-pytorch-compile-so-fast-kernel-fusion/))

### Programming Languages & Runtimes

- [Kernel Fusion Operations](https://awesome-repositories.com/f/programming-languages-runtimes/runtime-execution-environments/runtime-environments/runtimes/graph-symbolic-execution-engines/operation-kernels/kernel-fusion-operations.md) — Executes multiple unrelated calculations simultaneously within a single kernel to improve processing efficiency. ([source](https://pytorch.org/blog/why-is-pytorch-compile-so-fast-kernel-fusion/))
- [Sequential Operation Fusion](https://awesome-repositories.com/f/programming-languages-runtimes/runtime-execution-environments/runtime-environments/runtimes/graph-symbolic-execution-engines/operation-kernels/sequential-operation-fusion.md) — Combines consecutive mathematical operations into single kernels to keep data in fast registers. ([source](https://pytorch.org/blog/why-is-pytorch-compile-so-fast-kernel-fusion/))

### System Administration & Monitoring

- [Monitoring and Observability](https://awesome-repositories.com/f/system-administration-monitoring/monitoring-and-observability.md) — Provides visibility into request lifecycles and infrastructure health through distributed traces and metrics. ([source](https://pytorch.org/blog/lightseek-smg/))
