解決:TypeError: embedding(): argument ‘indices‘ (position 2) must be Tensor, not tuple

  這裏需要將註釋行取消掉。至於爲什麼,咱也不懂。 因爲檢查之後發現,傳入的數據其實是一個tuple 前面tensor是128組index組成的word_list,後面的tensor是每一句話對應的標籤,共128個。 所以要將前面的數據拿出來放入模型進行訓練,而不是整個tuple。 參考:https://blog.csdn.net/aioku/article/details/109367657
相關文章
相關標籤/搜索