Learn practical skills, build real-world projects, and advance your career

PyTorch - An easy Library mainly for Machine/Deep Learning Application

Operations using PyTorch

PyTorch is an open source Machine Learning library based on Torch library which can be used in many Machine Learning or Deep Learning application like Computer Vision , NLP (Natural Language Processing) etc. which is primarily built by Facebook.

Here are most frequently used function in PyTorch .
  1. Function 1 - torch.tensor()
  2. Function 2 - torch.add()
  3. Function 3 - torch.matmul()
  4. Function 4 - torch.reshape()
  5. Function 5 - torch.median()
  6. Function 6 - torch.max()
# Import torch and other required modules
import torch
import numpy as np

Function 1 - torch.tensor ()

A torch.Tensor is a multi-dimensional matrix containing elements/numbers.

Since tensor forms the basis for building neural network in PyTorch , its better to learn about tensors before moving forawrd to learn other operations available in PyTorch.

# Example 1 - working
torch.tensor([5,7])
tensor([5, 7])

Here we are creating tensor from the Python list using torch.tensor() constructor .