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

To execute this notebook online, "Fork" it to your profile and press the "Run" button and select the "Run on Binder" option.

Assignment 1 | Tensor Operations

PyTorch's tensor five amazing functions

The data structure used in PyTorch is graph based and tensor based, therefore,it is important to understand basic operations and defining tensors. in this assigment we'll show five important function we should use !

  • function 1 : torch.is_tensor
  • function 2 : torch.linspace
  • function 3 : torch.randperm & torch.arange
  • function 4 : torch.cat
  • function 5 : torch.chunk
# Import required modules
import torch
import numpy as np

Function 1| torch.is_tensor(obj)

Returns True if obj is a PyTorch tensor.

Let's have a look at the following Example