Archive of AI

Source Snapshot / 2016-09-01-meta-pytorch-open-source-3

PyTorch - Wikipedia

Linked event: 2016-09-01 · FAIR Open-Sources Deep Learning Framework PyTorch, Laying the Foundation for Global AI Research and Engineering Infrastructure

Publisher
Wikipedia
Archived
2026-11-23
Capture Method
Direct page capture
HTTP / SHA-256
200 / 44c014a117528ce5
Original URL
Open source ↗
Wayback Backup
Not archived
This page preserves a plain-text static snapshot against link rot. When citing figures, tables, or full legal terms, verify against the original URL and Wayback Machine archive.

[来源关键摘录] PyTorch is an open-source machine learning library based on the Torch library, originally developed by Meta AI (FAIR) and initially released in September 2016 under the BSD-3 license.

[正文前段节选] Jump to content

32 languages

Bahasa Indonesia

Bahasa Melayu

Српски / srpski

From Wikipedia, the free encyclopedia

Deep learning library

Original authors

Gregory Chanan

Soumith Chintala

DeveloperMeta AI

ReleaseSeptember 2016; 10 years ago (2016-09)[1]

Stable release

/ 28 October 2026; 24 days ago (28 October 2026)

Operating system

PlatformIA-32, x86-64, ARM64

Available inEnglish

TypeLibrary for deep learning

LicenseBSD-3[3]

Websitepytorch.org

Repositorygithub.com/pytorch/pytorch

Part of a series on

Machine learning

Association rules

Supervised learning

Unsupervised learning

Semi-supervised learning

Self-supervised learning

Reinforcement learning

Transfer learning

Meta-learning

Multimodal learning

Feature learning

Few-shot learning

Zero-shot learning

Online learning

Batch learning

Curriculum learning

Rule-based learning

Ontology learning

Neuro-symbolic AI

Neuromorphic engineering

Quantum machine learning

Classification

Generative modeling

Dimensionality reduction

Density estimation

Anomaly detection

Data cleaning

Semantic analysis

Structured prediction

Feature engineering

Learning to rank

Grammar induction

Supervised learning(classification • regression)

Apprenticeship learning

Decision trees

Random forest

Linear regression

Artificial neural networks

Logistic regression

Relevance vector machine (RVM)

Support vector machine (SVM)

Hierarchical

Expectation–maximization (EM)

Factor analysis

Graphical models

Conditional random field

Hidden Markov

Local outlier factor

Isolation forest

Neural networks

Deep learning

Feedforward neural network

Recurrent neural network

reservoir computing

Boltzmann machine

Diffusion model

Convolutional neural network

Neural field

Neural radiance field

Physics-informed neural networks

Spiking neural network

Memtransistor

Electrochemical RAM (ECRAM)

Policy gradient

Temporal difference (TD)

Learning with humans

Active learning

Human-in-the-loop

Mechanistic interpretability

Model diagnostics

Coefficient of determination

Confusion matrix

Learning curve

Mathematical foundations

Kernel machines

Bias–variance tradeoff

Computational learning theory

Empirical risk minimization

Occam learning

PAC learning

Statistical learning

Topological deep learning

Journals and conferences

Related articles

Glossary of artificial intelligence

List of datasets for machine-learning research

List of datasets in computer vision and image processing

Outline of machine learning

PyTorch is an open-source deep learning library, originally developed by Meta Platforms and currently developed with support from the Linux Foundation. The successor to Torch, PyTorch provides a high-level API that builds upon optimised, low-level implementations of deep learning algorithms and architectures, such as the Transformer, or SGD. Notably, this API simplifies model training and inference to a few lines of code. PyTorch allows for automatic parallelization of training and, internally, implements CUDA bindings that speed training further by leveraging GPU resources.

PyTorch utilises the tensor as a fundamental data type, similarly to NumPy. Training is facilitated by a reversed automatic differentiation system, Autograd, that constructs a directed acyclic graph of the operations (and their arguments) executed by a model during its forward pass. With a loss, backpropagation is then undertaken.[4]

As of 2025[update], PyTorch remains one of the most popular deep learning libraries, alongside others such as TensorFlow and Keras.[5] It can be installed using Anaconda package managers.[6] A number of commercial deep learning systems are built on top of PyTorch, including ChatGPT,[7] Tesla Autopilot,[8] Uber's Pyro,[9] and Hugging Face's Transformers.[10][11]

In 2001, Torch was written and released under a GPL by the Idiap Research Institute.[12] It was a machine-learning library written in C++ and CUDA, supporting methods including neural networks, support vector machines (SVM), hidden Markov models, etc.[13][14][15] Around 2010, it was rewritten by Ronan Collobert, Clement Farabet and Koray Kavuckuoglu. This was known as Torch7 or LuaTorch. This was written so that the backend was in C and the frontend was in Lua.[16] In mid-2016, some developers refactored it to decouple the frontend and the backend, with strong influence from torch-autograd and Chainer. In turn, torch-autograd was influenced by HIPS/autograd.[17] Development on Torch7 ceased in 2018 and was subsumed by the PyTorch project.[18][19]

Meta (formerly known as Facebook) operates both PyTorch and Convolutional Architecture for Fast Feature Embedding (Caffe2), but models defined by the two frameworks were mutually incompatible. The Open Neural Network Exchange (ONNX) project was created by Meta and Microsoft in September 2017 to decouple deep learning frameworks from hardware-specific runtimes, allowing models to be converted between frameworks and optimized for execution providers like NVIDIA’s TensorRT.[20] Caffe2 was merged into PyTorch at the end of March 2018.[21] In September 2022, Meta announced that PyTorch would be governed by the independent PyTorch Foundation, a newly created subsidiary of the Linux Foundation.[22]

PyTorch 2.0 was released on 15 March 2023, introducing TorchDynamo, a Python-level compiler that makes code run up to two times faster, along with significant improvements in training and inference performance across major cloud platforms.[23][24]

PyTorch tensors

Main article: Tensor (machine learning)

PyTorch defines a class called Tensor (torch.Tensor) to store and operate on homogeneous multidimensional rectangular arrays of numbers. PyTorch supports various sub-types of multi-dimensional arrays,[25] or Tensors.[26] PyTorch Tensors are similar to NumPy Arrays, but can also be operated on by a CUDA-capable NVIDIA GPU. PyTorch has also been developing support for other GPU platforms, for example, AMD's ROCm[27] and Apple's Metal Framework.[28]

PyTorch neural networks

Main article: Neural network (machine learning)

PyTorch defines a module called nn (torch.nn) to describe neural networks and to support training. This module offers a comprehensive collection of building blocks for neural networks, including various layers and activation functions, enabling the construction of complex models. Networks are built by inheriting from the torch.nn module and defining the sequence of operations in the forward() function.

PyTorch Serialized File Format

Pytorch can save and load models using its own file format, which is a ZIP64 archive containing the model weights in a Python pickle file, and other information such as the byte order. The file extensions .pt and .pth are commonly used for these files.[29]

The following program shows the low-level functionality of the library with a simple example.

import torch

dtype = torch.float

device = torch.device("cpu") # Execute all calculations on the CPU

# device = torch.device("cuda:0") # Executes all calculations on the GPU

# Create a tensor and fill it with random numbers

a = torch.randn(2, 3, device=device, dtype=dtype)

# Output: tensor([[-1.1884, 0.8498, -1.7129],

# [-0.8816, 0.1944, 0.5847]])

b = torch.randn(2, 3, device=device, dtype=dtype)

# Output: tensor([[ 0.7178, -0.8453, -1.3403],

# [ 1.3262, 1.1512, -1.7070]])

print(a * b)

# Output: tensor([[-0.8530, -0.7183, 2.58],

# [-1.1692, 0.2238, -0.9981]])

print(a.sum())

# Output: tensor(-2.1540)

print(a[1, 2]) # Output of the element in the third column of the second row (zero-based)

# Output: tensor(0.5847)

print(a.max())

# Output: tensor(0.8498)

The following code block defines a neural network with linear layers using the nn module.

from torch import nn # Import the nn sub-module from PyTorch

class NeuralNetwork(nn.Module): # Neural networks are defined as classes

def __init__(self): # Layers and variables are defined in the __init__ method

[...内容已截断,完整版请查看原文或 Wayback 快照]