PyTorch is a Open source framework for Machine Learning (machine learning) and is based on the programming language Python and the Torch library. It was developed in 2016 by a team of researchers for artificial intelligence by Facebook to improve the efficiency of developing and deploying research prototypes. PyTorch computes with tensors, which are accelerated by graphics processors (GPU for short). Over 200 different mathematical operations can be used with the framework.

Today, PyTorch is one of the most popular platforms for research in the field of Deep Learning and is mainly used for artificial intelligence (AI), data science and research. PyTorch is becoming increasingly popular because it makes it comparatively easy to create models for artificial neural networks (KNN) have created. PyTorch can also be used for reinforcement learning. It can be downloaded free of charge as open source from GitHub.

What is PyTorch Lightning?

PyTorch Lightning is a Open source library for Python and provides a high-level interface for PyTorch. The focus is on flexibility and performance to enable researchers, data scientists and machine learning engineers to create suitable and, most importantly, scalable ML systems. PyTorch Lightning is also available as open source for download from GitHub.

What are the features and benefits of PyTorch?

Dynamic graph calculation

The network behaviour can be changed spontaneously and the complete code does not have to be executed for this.

Automatic differentiation

Using backward sweeps in neural networks, the derivative of a function is calculated numerically.

User-friendly interface

It is called TorchScript and makes seamless switching between modes possible. It offers functionality, speed, flexibility and ease of use.

Python support

Since PyTorch is based on Python, it is easy to learn and programme and all libraries compatible with Python, such as NumPy or SciPy, can be used. Furthermore, uncomplicated debugging with Python tools is possible.


It takes place on important Cloud platforms a good support and is therefore easy to scale.

Dataset and DataLoader

It is possible to create your own dataset for PyTorch to store all the necessary data. The dataset is managed by means of DataLoader. Among other things, the DataLoader can run through the data, manage batches and transform data.

In addition, PyTorch can export learning models in the Open Neural Network Exchange (ONNX) standard format and has a C++ front-end interface option.

What are examples of the use of PyTorch?

  • Object detection
  • Segmentation (semantic segmentation)
  • LSTM (Long Short-Term Memory)
  • Transformer

PyTorch vs. Tensorflow

Tensorflow is also a deep learning framework and was developed by Google. It has been around longer than PyTorch and therefore has a larger developer community and more documentation. Both frameworks have their advantages and disadvantages, as they are intended for different projects.

While Tensorflow defines the computational graphs in a static way, PyTorch takes a dynamic approach. Also, the dynamic graphs can be manipulated in real time with PyTorch and only at the end with Tensorflow. Therefore, PyTorch is particularly suitable for uncomplicated prototyping and research work due to its simple and easy handling. Tensorflow, on the other hand, is particularly suitable for projects that require scalable production models.

PyTorch vs. scikit-learn

Scikit-learn (also called Sklearn) is a free library for Python and specialises in machine learning. It offers a range of Classification-, Regression- and Clustering algorithms, such as Random Forest, Support vector machines or k-means. Scikit-learn provides an efficient and straightforward Data analysis and is particularly suitable for defining algorithms, but is rather unsuitable for end-to-end training of deep neural networks, for which, on the other hand, PyTorch can be used very well.