Learn practical skills, build real-world projects, and advance your career
!pip install jovian --upgrade -q
import jovian
jovian.set_project('01-pytorch-basics')
jovian.set_colab_id('1wyAf0t1WNBjXwjG4j7Wj-RBHw7EmyBOa')
|████████████████████████████████| 71kB 3.0MB/s eta 0:00:011 Building wheel for uuid (setup.py) ... done

Import the torch module to get started.

import torch

Tensors

At its core, PyTorch is a library for processing tensors. A tensor is a number, vector, matrix, or any n-dimensional array. Let's create a tensor with a single number.

# Number
t1 = torch.tensor(4.)
t1
tensor(4.)