BUG pytorch

记录实验过程中遇到的问题

2022/4/3:oac

报错

RuntimeError: one of the variables needed for gradient computation has been modified by an inplace operation: [torch.FloatTensor [256, 1]], which is output 0 of AsStridedBackward0, is at version 2; expected version 1 instead. Hint: enable anomaly detection to find the operation that failed to compute its gradient, with torch.autograd.set_detect_anomaly(True).
Process finished with exit code 1

之前没问题,忽然一天就报错,但是我没有动过环境和代码。torch 版本 是1.10.2

解决方法

torch 版本换为1.4.0

方法来源

这个操作就很迷,之前不知道为啥能跑通,是在我不知道的时候,自己换版本了?

2022/4/4 : oc

报错

expected object of device type cuda but got device type cpu for argument #1BUG pytorch_第1张图片

你可能感兴趣的:(实验记录,python,pytorch)