Traceback (most recent call last):
File "char_and_word_compare.py", line 35, in <module>
char_embs=myLstm(char_embs,hidden,cell)
File "D:\Python\lib\site-packages\torch\nn\modules\module.py", line 532, in __call__
result = self.forward(*input, **kwargs)
File "D:\pycharmProject\lcqmc_analysis\LSTM.py", line 10, in forward
output,_=self.lstm(input_emb,(hidden,cell))
File "D:\Python\lib\site-packages\torch\nn\modules\module.py", line 532, in __call__
result = self.forward(*input, **kwargs)
File "D:\Python\lib\site-packages\torch\nn\modules\rnn.py", line 541, in forward
max_batch_size = input.size(0) if self.batch_first else input.size(1)
TypeError: 'int' object is not callable
如果你在运行模型之后遇到这种情况,检查一下你是否将你的数据转换成了tensor类型。我就是将numpy的输入到了模型当中,报了这样的错误。