Learn practical skills, build real-world projects, and advance your career
import torch
t1=torch.tensor(4.)
print(t1)
tensor(4.)
import numpy as np
print(np.zeros((4,4)))
[[0. 0. 0. 0.] [0. 0. 0. 0.] [0. 0. 0. 0.] [0. 0. 0. 0.]]
t1.dtype
torch.float32
t2=torch.tensor([1,2,3,4])
t2
tensor([1, 2, 3, 4])
t3=torch.tensor([[5.,6],[7,8],[9,10]])
t3
tensor([[ 5.,  6.],
        [ 7.,  8.],
        [ 9., 10.]])