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

##ASSIGNMENT 1

  These are some of the interesting functions I came across ......
  • function 1 - Eye
  • function 2 - Full
  • function 3 - Zeros
  • function 4 - Complex
  • function 5 - Rand
# Uncomment and run the appropriate command for your operating system, if required
 
# Linux / Binder
# !pip install numpy torch==1.7.0+cpu torchvision==0.8.1+cpu torchaudio==0.7.0 -f https://download.pytorch.org/whl/torch_stable.html
 
# Windows
# !pip install numpy torch==1.7.0+cpu torchvision==0.8.1+cpu torchaudio==0.7.0 -f https://download.pytorch.org/whl/torch_stable.html
 
# MacOS
# !pip install numpy torch torchvision torchaudio
# Import torch and other required modules
import torch

Function 1 - torch.eye

  The torch.eye function returns a 2-D tensor with ones on the diagonal and zeros elsewhere.
 torch.eye(4)
tensor([[1., 0., 0., 0.],
        [0., 1., 0., 0.],
        [0., 0., 1., 0.],
        [0., 0., 0., 1.]])