【error】ValueError: result of slicing is an empty tensor

报错:

ValueError: result of slicing is an empty tensor

出错位置:        

packed_scores = pack_padded_sequence( pack_scores, lengths, batch_first=True )

出错原因:

pack_scores的维度为[batch, len, *],lengths为batch长度的list,每一个元素为pack_scores对应的长度。出现这种错误的原因是length中的某一个元素大于pack_scores的1维长度。

参考网址:

https://stackoverflow.com/questions/48626992/result-of-slicing-in-an-empty-tensor

猜你喜欢

转载自blog.csdn.net/ccbrid/article/details/80270095
今日推荐