TypeError: can't convert np.ndarray of type numpy.object_. code example

Example: can't convert np.ndarray of type numpy.object_.

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)