taishan1994 / pytorch_triple_extraction

基于pytorch的中文三元组提取(命名实体识别+关系抽取)
330 stars 41 forks source link

stack expects each tensor to be equal size, but got [22] at entry 0 and [106] at entry 1 #21

Closed Lv-shuai closed 1 year ago

Lv-shuai commented 1 year ago

作者您好, 之前能运行,后来重装了一下环境,结果维度不匹配了。问题如下 return torchstack(batch, dim =' . out=out) RuntimeError: stack expects each tensor to be equal size, but got [22] at entry 0 and [106] at entry 1

batch中的两个向量维度不匹配,batch[0]==22,batch[1]==106,这个batch该怎么扩增呢? 或者您的torch版本是多少?可能是torch对stack函数进行了修改。

taishan1994 commented 1 year ago

作者您好, 之前能运行,后来重装了一下环境,结果维度不匹配了。问题如下 return torchstack(batch, dim =' . out=out) RuntimeError: stack expects each tensor to be equal size, but got [22] at entry 0 and [106] at entry 1

batch中的两个向量维度不匹配,batch[0]==22,batch[1]==106,这个batch该怎么扩增呢? 或者您的torch版本是多少?可能是torch对stack函数进行了修改。

torch=1.6或者1.1看看