版权声明:转载注明出处 https://blog.csdn.net/york1996/article/details/82707730
RuntimeError: Assertion `x >= 0. && x <= 1.' failed. input value should be between 0~1, but got -0.234535 at c:\new-builder_3\win-wheel\pytorch\aten\src\thnn\generic/BCECriterion.c:62
可能原因是nn.BCELoss()的输入要是0到1的小数。而不是一个负数或者一个大于1的数字。有可能是因为你的激活函数的输出值不在0到1之间了。比如tanh,改成sigmoid可以解决。
更深层次的原因有待探究。