100% developed

PyTorch/Introduction

From Wikibooks, open books for an open world
Jump to navigation Jump to search

Introduction[edit | edit source]

PyTorch, aka pytorch, is a package for deep learning. It can also be used for shallow learning, for optimization tasks unrelated to deep learning, and for general linear algebra calculations with or without CUDA.

PyTorch is one of many packages for deep learning. As for November 2018, it was the second after TensorFlow by number of contributors, the third after TensorFlow and Caffe by number of stars in github [1]. Keras also should be mentioned here.

PyTorch descended from the Torch package under a language called Lua. For that reason, pytorch is called torch within python. For example, import torch but conda update pytorch.

To install PyTorch, go to it's official page, [pytorch.org]. Unfortunately, you cannot install PyTorch with sudo apt install.

Advandages and disadvantages[edit | edit source]

PyTorch is simpler and easier to learn than TensorFlow, and offers more freedom. As Kirill Doubikov wrote[2],

Overall, the [PyTorch] framework is more tightly integrated with Python language and feels more native most of the times. When you write in TensorFlow sometimes you feel that your model is behind a brick wall with several tiny holes to communicate over.

On the other hand, he wrote:

Currently, TensorFlow is considered as a to-go tool by many researchers and industry professionals. The framework is well documented and if the documentation will not suffice there are many extremely well-written tutorials on the internet. You can find hundreds of implemented and trained models on github, start here.

PyTorch is relatively new compared to its competitor (and is still in beta), but it is quickly getting its momentum. Documentation and official tutorials are also nice. PyTorch also include several implementations of popular computer vision architectures which are super-easy to use.

As for September 2019, PyTorch is not beta anymore, but the difference still holds.

TensorFlow has a great visualization tool, TensorBoard. Starting from the version 1.1, PyTorch also wholly supports TensorBoard.