1import torch
2import numpy as np
3
4# Your test array without 'dtype=object'
5a = np.array([
6 np.array([-0.4287 , -1.193 , -2.156 , -0.2264 , -1.978 , -1.101 , -3.395 , 0.2974 ], dtype=np.float16),
7 np.array([-0.3386 , 1.398 , -1.083 , 0.2961 , -0.7354 , -1.326 , -4.33 , 0.6284 ], dtype=np.float16)
8])
9
10print(a.dtype) # This should not be 'object'
11
12b = torch.from_numpy(a)
13
14print(b)
15