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

First Assigment

Use 5 function from PyTorch documentation

An short introduction about PyTorch and about the chosen functions.

  • torch.zeros()
  • torch.Tensor.item()
  • torch.abs()
  • torch.add()
  • torch.div()
# Import torch and other required modules
import torch

Function 1 - torch.zeros()

create a tensor with all of its elements are zeros

# Example 1 - create the zeros tensor
torch.zeros([2])
tensor([0., 0.])

create an tensor of 2 rows and 4 columns full of zeros