I have just solved this problem before, but I don’t know if it is suitable for you. Please check your following aspects:
1 The type of data you entered, LongTensor or something else
2 Is the shape of your neural network the same as the shape of your data?