- 博客(1)
- 问答 (2)
- 收藏
- 关注
原创 IndexError: Dimension out of range (expected to be in range of [-1, 0], but got 1)报错
在使用softmax函数时需要保证矩阵是二维的,但是在训练过程中会出现batchsize=1的情况即整个output矩阵的维度为。output = F.softmax(output, dim=1) 即可。如果不指定 output.squeeze 的维度就会得到。[maxlen]的维度导致报错。
2023-03-15 20:19:45 1194 1
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人