import torch
x=torch.tensor([[10,20],[2,4]])print(x)
tensor([[10, 20],[2, 4]])import torch
a=[[10.2,20.6],[2,4]]
x=torch.DoubleTensor(a)print(x)
y=torch.IntTensor(a)print(y)
tensor([[10.2000,20.6000],[2.0000,4.0000]], dtype=torch.float64)
tensor([[10,20],[2,4]], dtype=torch.int32)<ipython-input-14-f9db31b67daa>:5: DeprecationWarning: an integer is required (got typefloat). Implicit conversion to integers using __int__ is deprecated,and may be removed in a future version of Python.y=torch.IntTensor(a)