Meet YOLO26: next-gen vision AI.
Ultralytics
Back to Ultralytics Glossary

PyTorch

Explore PyTorch, the core library powering Ultralytics YOLO26. Learn about its dynamic graphs, GPU acceleration, and how to build efficient deep learning models.

PyTorch is an open-source machine learning library primarily developed by Meta AI that has become a cornerstone for researchers and developers in the field of deep learning. Known for its flexibility and ease of use, it allows users to build and train complex neural networks using a dynamic computational graph. This feature, often referred to as "eager execution," enables code to be evaluated immediately, making debugging and prototyping significantly more intuitive compared to frameworks that rely on static graph definitions. It integrates seamlessly with the Python programming language, feeling like a natural extension of standard scientific computing tools.

Link to this sectionCore Mechanics and Significance#

At the heart of this framework are tensors, which are multi-dimensional arrays similar to those found in the NumPy documentation. However, unlike standard arrays, PyTorch tensors are designed to leverage GPU acceleration provided by NVIDIA CUDA. This hardware acceleration is critical for the massive parallel processing required to train modern artificial intelligence (AI) models efficiently.

The library supports a vast ecosystem of tools for computer vision (CV) and natural language processing. By providing a rich set of pre-built layers, optimizers, and loss functions, it simplifies the process of creating algorithms for tasks like image classification and sequence modeling.

Link to this sectionReal-World Applications#

The versatility of this framework has led to its adoption across diverse industries for high-impact AI solutions:

  1. Autonomous Vehicles: Industry leaders leverage PyTorch to build deep learning models that process video feeds from car cameras. These models perform real-time object detection to identify lanes, signs, and pedestrians, enabling safer navigation.

  2. Medical Diagnostics: Researchers use the framework to develop advanced healthcare applications. For instance, it powers systems that analyze MRI scans or X-rays to assist doctors in detecting tumors via precise image segmentation.

To better understand its role, it is helpful to distinguish PyTorch from other common tools in the AI stack:

  • Vs. TensorFlow: Developed by Google, TensorFlow historically relied on static computational graphs, which made debugging harder but optimized deployment. While both frameworks have converged in features, PyTorch is often preferred for rapid prototyping and research due to its intuitive interface.
  • Vs. OpenCV: OpenCV is a library focused on traditional image processing functions (like resizing, filtering, and color conversion) rather than training neural networks. In a typical workflow, developers use OpenCV for data preprocessing before feeding the images into a PyTorch model for analysis.

Link to this sectionIntegration with Ultralytics#

The entire Ultralytics model family, including the cutting-edge YOLO26 and the widely used YOLO11, is built natively on PyTorch. This foundation ensures that users benefit from the framework's speed, stability, and extensive community support. Whether performing transfer learning on custom training data or exporting models for edge devices, the underlying architecture relies on PyTorch tensors and gradients.

The upcoming Ultralytics Platform further simplifies this experience, providing a unified interface to manage dataset sourcing, training, and deployment without needing to write extensive boilerplate code.

The following example demonstrates how to verify GPU availability and run inference using a YOLO model, showcasing how the framework handles hardware acceleration under the hood:

import torch
from ultralytics import YOLO

# Check if CUDA (GPU) is available for PyTorch acceleration
device = "cuda" if torch.cuda.is_available() else "cpu"
print(f"PyTorch is using device: {device}")

# Load a YOLO26n model (built on PyTorch)
model = YOLO("yolo26n.pt")

# Perform object detection on an image
# PyTorch handles tensor operations and moves data to the GPU automatically
results = model("https://ultralytics.com/images/bus.jpg", device=device)

Explore solutions

Real-time AI that works with your team

AI in Robotics

Power smarter machines with Ultralytics YOLO models. Vision AI in robotics drives autonomous navigation, perception, object tracking, and real-time control.

Learn more
Real-time AI that works with your team

AI in Logistics

Streamline logistics with Ultralytics YOLO models. Vision AI enables package inspection, sorting, vehicle tracking, and real-time warehouse safety monitoring.

Learn more
Real-time AI that works with your team

AI in Retail

Reimagine retail with Ultralytics YOLO models. Vision AI powers inventory tracking, shelf monitoring, queue management, and smarter customer insights.

Learn more
Real-time AI that works with your team

AI in Healthcare

Build healthcare solutions with Ultralytics YOLO models. Vision AI in healthcare powers faster medical imaging, smarter diagnostics, and patient monitoring.

Learn more
Real-time AI that works with your team

AI in Manufacturing

Optimize manufacturing with Ultralytics YOLO models. Vision AI drives quality control, defect detection, PPE compliance, and assembly line automation.

Learn more
Real-time AI that works with your operation

AI in Automotive

Apply computer vision in automotive with Ultralytics YOLO models. Vision AI elevates road safety, driver assistance, and vehicle automation for smarter roads.

Learn more
Real-time AI tailored to your operation

AI in Agriculture

Bring vision AI to smart agriculture with Ultralytics YOLO models. Power crop monitoring, livestock tracking, and precision farming for higher, smarter yields.

Learn more
Real-time AI that works with your team

AI in Robotics

Power smarter machines with Ultralytics YOLO models. Vision AI in robotics drives autonomous navigation, perception, object tracking, and real-time control.

Learn more
Real-time AI that works with your team

AI in Logistics

Streamline logistics with Ultralytics YOLO models. Vision AI enables package inspection, sorting, vehicle tracking, and real-time warehouse safety monitoring.

Learn more
Real-time AI that works with your team

AI in Retail

Reimagine retail with Ultralytics YOLO models. Vision AI powers inventory tracking, shelf monitoring, queue management, and smarter customer insights.

Learn more
Real-time AI that works with your team

AI in Healthcare

Build healthcare solutions with Ultralytics YOLO models. Vision AI in healthcare powers faster medical imaging, smarter diagnostics, and patient monitoring.

Learn more
Real-time AI that works with your team

AI in Manufacturing

Optimize manufacturing with Ultralytics YOLO models. Vision AI drives quality control, defect detection, PPE compliance, and assembly line automation.

Learn more
Real-time AI that works with your operation

AI in Automotive

Apply computer vision in automotive with Ultralytics YOLO models. Vision AI elevates road safety, driver assistance, and vehicle automation for smarter roads.

Learn more
Real-time AI tailored to your operation

AI in Agriculture

Bring vision AI to smart agriculture with Ultralytics YOLO models. Power crop monitoring, livestock tracking, and precision farming for higher, smarter yields.

Learn more
Real-time AI that works with your team

AI in Robotics

Power smarter machines with Ultralytics YOLO models. Vision AI in robotics drives autonomous navigation, perception, object tracking, and real-time control.

Learn more
Real-time AI that works with your team

AI in Logistics

Streamline logistics with Ultralytics YOLO models. Vision AI enables package inspection, sorting, vehicle tracking, and real-time warehouse safety monitoring.

Learn more
Real-time AI that works with your team

AI in Retail

Reimagine retail with Ultralytics YOLO models. Vision AI powers inventory tracking, shelf monitoring, queue management, and smarter customer insights.

Learn more
Real-time AI that works with your team

AI in Healthcare

Build healthcare solutions with Ultralytics YOLO models. Vision AI in healthcare powers faster medical imaging, smarter diagnostics, and patient monitoring.

Learn more
Real-time AI that works with your team

AI in Manufacturing

Optimize manufacturing with Ultralytics YOLO models. Vision AI drives quality control, defect detection, PPE compliance, and assembly line automation.

Learn more
Real-time AI that works with your operation

AI in Automotive

Apply computer vision in automotive with Ultralytics YOLO models. Vision AI elevates road safety, driver assistance, and vehicle automation for smarter roads.

Learn more
Real-time AI tailored to your operation

AI in Agriculture

Bring vision AI to smart agriculture with Ultralytics YOLO models. Power crop monitoring, livestock tracking, and precision farming for higher, smarter yields.

Learn more

Let's build the future of AI together!

Begin your journey with the future of machine learning