What Is PyTorch?

Written by Coursera Staff • Updated on

Learn more about the Python framework PyTorch for deep learning, including how it works, who uses PyTorch, and how to install it.

[Featured Image] A data scientist uses PyTorch on her laptop in her office.

Python offers several frameworks and libraries for developing artificial intelligence. One of these libraries is PyTorch, developed by Facebook's AI research lab and released in 2016. Providing the benefits of Torch's efficient back-end libraries and Python's intuitive front-end, PyTorch offers user-friendliness, fast prototyping, and a vast community for support, making it popular for use in artificial intelligence applications, including natural language processing and deep learning.

The use of artificial intelligence is growing in today's market, and this trend only looks to continue. Industries such as health care, education, retail, manufacturing, finance, customer service, and many more actively utilize AI technology to improve their offerings. Even many of the products and devices you likely use regularly feature artificial intelligence. For example, streaming services use AI to make recommendations for shows and movies based on your preferences, and navigation applications like Google Maps use AI to find the optimal route to your destination. Building applications such as these and many other AI tasks become much more manageable with the help of libraries and frameworks such as PyTorch.

What is PyTorch?

This open-source, Python-based framework enables you to build deep learning models. Python is a beginner-friendly language, adding to the convenience of PyTorch. However, although Python is relatively simple to use compared to other programming languages, it’s a powerful language and widely used for developing artificial intelligence. 

 One particular benefit of PyTorch is that it enables you to prototype and experiment with deep learning models quickly. Because of this, it’s especially useful when working on smaller projects. The deep learning models you develop with PyTorch can be used in applications in several areas, including natural language processing, computer vision, and reinforcement learning. 

To start working with PyTorch, you first need to have Python installed and one of the supported package managers, pip, and Anaconda. 

What is a deep learning model?

Inspired by the human brain, deep learning models go through training and learn similarly to human beings. Deep learning models can identify key insights and develop predictions based on data patterns found in sources such as images, text, and audio. 

What separates deep learning from other machine learning models is the number of neural network layers within the model. In the case of deep learning models, they contain at least three layers. Another differentiator of deep learning models from some standard machine learning models is the ability to process unstructured data, allowing the models to learn without needing as much human assistance.

PyTorch features

PyTorch has numerous features that make it effective in supporting efficient prototyping and experimentation for machine learning models:

  • You can perform modifications to create dynamic neural networks efficiently through reverse-mode auto-differentiation.

  • PyTorch supports a C++ interface in addition to Python for creating applications.

  • The TorchServe tool in PyTorch allows you to build scalable models through the cloud. 

  • PyTorch can extend its API to use machine learning in both iOS and Android applications.

  • PyTorch has an entire community of researchers and developers who create libraries to further the reach of PyTorch into more facets of artificial intelligence. 

  • The computational work performed in PyTorch can extend through multiple CPUs and GPUs for distributed training and parallel processing.

  • Data loading and processing from several sources and data types is possible in PyTorch with the help of tools such as the torchvision package.

How PyTorch works

PyTorch operates through tensors and graphs. Tensors work by numerically representing non-numerical data, such as the data provided through images and text. This allows the model to manipulate and store various inputs and outputs. Graphs direct how data moves through the neural networks within deep learning models with directions on what operations to perform at the different nodes within the neural networks. 

The PyTorch ecosystem

Another valuable feature of PyTorch is the PyTorch ecosystem. The PyTorch ecosystem is a collection of libraries and tools that further support the development of artificial intelligence. Within the PyTorch ecosystem, you can find open-source libraries that members of the PyTorch community contribute to, leading to accelerated growth and support for AI. Here are some examples of tools and libraries the PyTorch ecosystem offers:

  • Flair for natural language processing in a straightforward framework.

  • PyTorchVideo for video-centric deep learning and a better understanding of research. 

  • Determined for more efficient model training and sharing GPU resources.

  • Glow improves deep learning performance on different platforms.

  • Horovod is a deep learning framework library for distributed deep learning.

  • TorchText processes natural language using pre-trained models.

  • Torchvision provides data sets and the necessary architecture for object detection and image classification.

  • MONAI is a healthcare-specific tool for creating image-based training workflows.

Who uses PyTorch?

PyTorch is a relevant and valued skill for professionals across a number of positions and in several fields. As a deep learning engineer, much of the modeling you will be doing will likely occur in Python, where PyTorch is a valuable tool. PyTorch is important for data science as well. Data scientists benefit from the prototyping efficiency of PyTorch, in addition to its compatibility with other tools and simple debugging process. For software developers, PyTorch has several tools in its ecosystem that you can utilize to develop artificial intelligence models.

Some examples of businesses implementing PyTorch include Salesforce for natural language processing and Amazon Advertising. Additionally, Stanford University uses PyTorch for research purposes to establish algorithmic approaches.

Getting started with Coursera

On Coursera, you can find highly-rated courses to learn more about artificial intelligence, programming with Python, and using PyTorch. The IBM AI Engineering Professional Certificate is a great opportunity to earn an employer-recognized certification and develop relevant skills in machine learning, deep learning, neural networks, and gain experience building deep learning models with PyTorch.

You can also enroll in Deep Learning with PyTorch: Generative Adversarial Network offered by the Coursera Project Network. This course can allow you to work on real-world problems and further grow your programming skills in Python and PyTorch.

Keep reading

Updated on
Written by:

Editorial Team

Coursera’s editorial team is comprised of highly experienced professional editors, writers, and fact...

This content has been made available for informational purposes only. Learners are advised to conduct additional research to ensure that courses and other credentials pursued meet their personal, professional, and financial goals.