Learn practical skills, build real-world projects, and advance your career
Created 4 years ago
#!pip install jovian --upgrade
import jovian
import torch
import torch.nn
import numpy as np
torch.manual_seed(123)
<torch._C.Generator at 0x7efb9caef910>
Basic of Pytorch
For a scalar
# directly creating tensor
# A tensor is a number, vector, matrix or any n-dimensional array. Let's create a tensor with a single number:
t1 = torch.tensor([3.])
t1 , t1.dtype
(tensor([3.]), torch.float32)
For a Vector