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

Exploring Pytorch functions

A walk through Pytorch's tensor functions

An short introduction about PyTorch and about the chosen functions.

  • clone()
  • requires_grad_()
  • split()
  • where()
  • linspace()
# Import torch and other required modules
import torch

Function 1 - clone()

This function is used to create a copy of your tensor

# Example 1 - working (change this)
t1 = torch.tensor([[1, 2], [3, 4.]], requires_grad=True)
x = torch.tensor([[3,4], [6,7]])
L = t1 * x