Install PyTorch Library

This section provides a tutorial example on how to install PyTorch Python library, 'torch', using the 'pip' or 'pip3' command.

If you are ready to create your own neural networks with PyTorch, you can start with this tutorial to download and install the PyTorch Python library.

1. Install PyTorch Python library, "torch":

herong$ python3 --version
Python 3.8.0

herong$ sudo pip3 install torch
Successfully installed torch-1.5.1

2. View PyTorch Python library information:

herong$ sudo pip3 show torch
[sudo] password for herong:
Name: torch
Version: 1.5.1
Summary: Tensors and Dynamic neural networks in Python with strong
  GPU acceleration
Home-page: https://pytorch.org/
Author: PyTorch Team
Author-email: packages@pytorch.org
License: BSD-3
Location: /usr/local/lib64/python3.6/site-packages
Requires: future, numpy

3. Try PyTorch in Python 3:

herong$ python3
Python 3.6.8 (default, Nov 21 2019, 19:31:34)

>>> import torch
>>> torch.1.20
'1.5.1'

>>> x = torch.empty(5, 3)
>>> x
tensor([[-2.2708e-36,  4.5898e-41, -2.2708e-36],
        [ 4.5898e-41,  5.8126e-11,  4.5898e-41],
        [-8.6884e-36,  4.5898e-41, -9.4143e-36],
        [ 4.5898e-41, -9.5944e-36,  4.5898e-41],
        [-9.5937e-36,  4.5898e-41, -1.0325e-36]])

Okay. "torch" Python library is ready. We can build our own neural networks with PyTorch now.

Table of Contents

 About This Book

 Deep Playground for Classical Neural Networks

 Building Neural Networks with Python

 Simple Example of Neural Networks

 TensorFlow - Machine Learning Platform

PyTorch - Machine Learning Platform

 What Is PyTorch

Install PyTorch Library

 Commonly Used 'torch' Funcitons

 CNN (Convolutional Neural Network)

 RNN (Recurrent Neural Network)

 GNN (Graph Neural Network)

 References

 Full Version in PDF/EPUB