Hi, I want to read mat files in jupyter and convert as tensor. So I use scipy.io but I can’t convert to tensor.
import scipy.io as spio
import torch
import numpy as np
data = spio.loadmat(‘train.mat’)
np_data = np.array(data)
tensor_data = torch.Tensor(np_data)
but result is
TypeError Traceback (most recent call last)
in
----> 1 tensor_data = torch.Tensor(np_data)
TypeError: can’t convert np.ndarray of type numpy.object_. The only supported types are: float64, float32, float16, int64, int32, int16, int8, uint8, and bool.
what should I have to do?