出现这个问题是计算loss的时候与loss函数要求的维度不匹配。

【error】RuntimeError: multi-target not supported at /pytorch/torch/lib/THCUNN/generic/ClassNLL

要求input是(N,C)维,target是N维,在我的实验中,input是(64,751)维,target变成(64,1)维,去掉target中维度为1 的维

cls1_loss=criterion_cls(cls1,torch.squeeze(labels_t))

target变成64 即可。

相关文章:

  • 2022-12-23
  • 2021-04-22
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-18
  • 2021-11-14
  • 2021-11-27
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-05-09
  • 2022-12-23
  • 2021-07-18
相关资源
相似解决方案