1.RuntimeError: cannot unsqueeze empty tensor
数据读取/数据输入输出问题
[start:end] 切片
打印涉及到的shape。start。end 看一看
解决掉了 判断超出范围的话就break
2.IndexError: boolean index did not match indexed array along dimension 0; dimension is 340 but corresponding boolean dimension is 319
squeeze(axis=-1) 是一个 Python 函数,它可以删除给定数组的最后一个轴。它用于减少数组的维度,使其更容易处理
idx是319 attention是340
解决方法 直接把idx的shape补成和attention一样的 布尔数组 保持前面的不变 后面的补false
3.tuple是pyhton中的元组数据类型
4.ValueError: Found input variables with inconsistent numbers of samples: [76373, 81403]
这个是labels和predictions长度不一样 解决方法是把predictions给截断成和labels一样的len
这个代码也太奇怪了 在输入上一直出问题
输入参数变量与样本数不一致
我的妈呀 终于调通了 全是输入输出问题 = =调了三天