Safekipedia
Deep learning softwareFacebook softwareFree science softwareFree software programmed in C

PyTorch

Adapted from Wikipedia ยท Adventurer experience

PyTorch logo white

PyTorch is an open-source deep learning library made by Meta Platforms and now supported by the Linux Foundation. It replaces an older tool called Torch and makes building and training models simpler. With PyTorch, you can complete tough tasks like training deep learning models with just a few lines of code.

PyTorch works with special data called a tensor, which is similar to tools in NumPy. It uses a system called Autograd to help make models better during training. This system keeps track of all the steps in training so the computer can adjust the model well.

As of 2025, PyTorch is very popular for deep learning. It is used with other tools like TensorFlow and Keras. You can install it using Anaconda. Many important technologies use PyTorch, such as ChatGPT, Tesla Autopilot, Uber's Pyro, Hugging Face's Transformers, and Catalyst.

History

In 2001, a machine-learning library called Torch was created. It supported many methods, including neural networks and support vector machines. Around 2010, it was rewritten with a frontend in Lua. In 2016, some developers began working on a new version called PyTorch.

Meta Platforms started developing PyTorch, and in 2018, they merged another library called Caffe2 into it. In 2022, PyTorch became part of the independent PyTorch Foundation under the Linux Foundation. The latest major update, PyTorch 2.0, was released in March 2023, making code run faster on major cloud platforms.

PyTorch tensors

Main article: Tensor (machine learning)

PyTorch uses something called a Tensor (torch.Tensor) to store numbers in a multi-dimensional array. These Tensors work like arrays in NumPy but can use special parts of computers called GPUs to make calculations faster. PyTorch supports GPUs from companies like NVIDIA and also works with other technologies such as AMD's ROCm and Apple's Metal Framework.

PyTorch neural networks

Main article: Neural network (machine learning)

PyTorch uses a special part called nn (or torch.nn) to help build neural networks. This part gives you many tools, like different layers and functions. You can create your own network by using these tools and telling the computer the steps it needs to follow. This makes it easier to teach computers new things!

Example

This example shows how PyTorch works with a simple program. It makes special number groups called tensors and does basic math with them. The code also shows how to build a small neural network using PyTorch's tools. Neural networks are like digital brains that can learn from data to solve problems.

This article is a child-friendly adaptation of the Wikipedia article on PyTorch, available under CC BY-SA 4.0.

Images from Wikimedia Commons. Tap any image to view credits and license.