RuntimeError: expected scalar type Int but found Float解决思路之一

写模型的时候出现如下问题:

(其中的类型其实可以任意变换)

RuntimeError: expected scalar type Int but found Float解决思路之一_第1张图片

我的问题出在投进的数据问题,即x_t数据类型出问题了

x_t的类型应该是tensorInt

我们要在预处理数据的时候转成tensorFloat

原:

inpu_t = torch.from_numpy(np.asarray(input))

现:

inpu_t = torch.from_numpy(np.asarray(input)).float()

你可能感兴趣的:(pytorch,神经网络)