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

Week 1 PyTorch Assignment

PyTorch Functions

An short introduction about PyTorch and about the chosen functions.

  • torch.tensor()
  • torch.randn()
  • torch.mm()
  • torch.t()
  • torch.cat()
# Import torch and other required modules
import torch

Function 1 - torch.tensor

A torch.Tensor is a multi-dimensional matrix containing elements of a single data type.

# Example 1 
torch.tensor([[3, 4], [1, 2]])