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的輸入到了模型當中,報了這樣的錯誤。