1. 问题:
TypeError: can’t convert np.ndarray of type numpy.object_. The only supported types are: double, float, float16, int64, int32, and uint8.
2. 异常代码行:
train_x = torch.from_numpy(train_x).float().unsqueeze(1) # numpy 转成 torch 类型
3. 相关代码:
train.py
from getData import getAllData
from sklearn.model_selection import train_test_split
data = getAllData()
X, Y = data.XY()
print(type(X)) # <class 'list'>
print(np.shape