Learn practical skills, build real-world projects, and advance your career
Created 5 years ago
import jovian
import torch
# Vector
t2 = torch.tensor([1.,2,3,4])
print(t2)
tensor([1., 2., 3., 4.])
# Matrix
t3 = torch.tensor([[5.,6],[7,8],[9,10]])
print(t3)
tensor([[ 5., 6.],
[ 7., 8.],
[ 9., 10.]])
# 3-dimensional array
t4 = torch.tensor([
[[11,12,13],
[13,14,15]],
[[15,16,17],
[17,18,19.]]])
print(t4)
tensor([[[11., 12., 13.],
[13., 14., 15.]],
[[15., 16., 17.],
[17., 18., 19.]]])
import numpy as np
x = np.array([[1,2],[3,4]])
print(x)
[[1 2]
[3 4]]