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

出現這個問題是計算loss的時候與loss函數要求的維度不匹配。 要求input是(N,C)維,target是N維,在我的實驗中,input是(64,751)維,target變成(64,1)維,去掉target中維度爲1 的維 cls1_loss=criterion_cls(cls1,torch.squeeze(labels_t)) target變成64 即可。
相關文章
相關標籤/搜索