unable to get repr for class ‘torch.tensor’

Posted 菜是原罪zm

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了unable to get repr for class ‘torch.tensor’相关的知识,希望对你有一定的参考价值。

1.调试程序发现计算loss的时候出现如题所示错误,导致后续程序报CUDA的错

nn.CrossEntropyLoss(),我设置ignore_index为0,mask设为0,1,2,做2分类,就会这样

 

2.将ignore_index改为-1,计算loss的时候把mask=mask-1,就能正常分类

 

不知道为啥会出现这种情况

以上是关于unable to get repr for class ‘torch.tensor’的主要内容,如果未能解决你的问题,请参考以下文章

I/O error on GET request for,PKIX path building failed,,unable to find valid certification path

git clone报错:fatal: unable to access ‘‘: SSL certificate problem: unable to get local issuer cer

git clone报错:fatal: unable to access ‘‘: SSL certificate problem: unable to get local issuer cer

Hibernate - HHH000352: Unable to release batch statement

Unable to load dispatcher.filter.StrutsPrepareAndExecuteFilter

java.lang.RuntimeException: Unable to get provider