torch.from_numpy()用来将数组array转换为张量Tensor
a=np.array([1,2,3,4])
print(a)
#[1 2 3 4]
print(torch.from_numpy(a))
#tensor([1, 2, 3, 4], dtype=torch.int32)
torch.from_numpy()用来将数组array转换为张量Tensor
a=np.array([1,2,3,4])
print(a)
#[1 2 3 4]
print(torch.from_numpy(a))
#tensor([1, 2, 3, 4], dtype=torch.int32)