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

Tensor learings with 5 intersting functions

  • zeros
  • complex
  • cat
  • rand
  • transpose

Before we begin, let's install and import PyTorch

# Import torch and other required modules
import torch

Function 1 - torch.zeros

creates tensor with zero values

# Example 1 - 
t1=torch.zeros(5)
t1
tensor([0., 0., 0., 0., 0.])

also available for ones too