📅  最后修改于: 2022-03-11 14:47:22.241000             🧑  作者: Mango
import torch
import numpy as np
# Your test array without 'dtype=object'
a = np.array([
np.array([-0.4287 , -1.193 , -2.156 , -0.2264 , -1.978 , -1.101 , -3.395 , 0.2974 ], dtype=np.float16),
np.array([-0.3386 , 1.398 , -1.083 , 0.2961 , -0.7354 , -1.326 , -4.33 , 0.6284 ], dtype=np.float16)
])
print(a.dtype) # This should not be 'object'
b = torch.from_numpy(a)
print(b)