RuntimeError: Expected object of scalar type Double but got scalar type Float for argument #2 'mat2'

The solution is to convert the data used:

original:

prediction, h_state = rnn(x, h_state)

Plus type conversion:

x = torch.tensor(x, dtype=torch.float32)
prediction, h_state = rnn(x, h_state)
Published 41 original articles · praised 13 · visits 6692

Guess you like

Origin blog.csdn.net/comli_cn/article/details/104609123