美文网首页
torch CTC loss :The size of tens

torch CTC loss :The size of tens

作者: qizhen816 | 来源:发表于2020-05-25 15:31 被阅读0次

    训练一个ocr模型的时候torch版本升级导致:
    The size of tensor a (0) must match the size of tensor b (37) at non-singleton dimension 2
    问题出现在loss.backward()部分,后来阅读相关代码发现在计算loss的时候需要关闭cudnn:

                torch.backends.cudnn.enabled = False
                loss = criterion(preds, text, preds_size, length)
                torch.backends.cudnn.enabled = True
    

    相关文章

      网友评论

          本文标题:torch CTC loss :The size of tens

          本文链接:https://www.haomeiwen.com/subject/zvmyahtx.html