Learn practical skills, build real-world projects, and advance your career
import torch
x =torch.tensor([[1,2,3],[5,6,7],[8,9,10]])
print(x)
tensor([[ 1, 2, 3], [ 5, 6, 7], [ 8, 9, 10]])
print(x.shape) #it gives you the shape  of the matrix
print(x.size())
torch.Size([3, 3]) torch.Size([3, 3])
y=torch.FloatTensor([[1,4,5],[5,8,9],[9,6,12]])
print(y)
tensor([[ 1., 4., 5.], [ 5., 8., 9.], [ 9., 6., 12.]])
z=torch.DoubleTensor([[6,9,3],[4,5,9],[3,9,6],[6,3,5]])
print(z)
tensor([[6., 9., 3.], [4., 5., 9.], [3., 9., 6.], [6., 3., 5.]], dtype=torch.float64)