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

 

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

这里需要将注释行取消掉。至于为什么,咱也不懂。

因为检查之后发现,传入的数据其实是一个tuple

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

前面tensor是128组index组成的word_list,后面的tensor是每一句话对应的标签,共128个。

所以要将前面的数据拿出来放入模型进行训练,而不是整个tuple。

参考:https://blog.****.net/aioku/article/details/109367657