PyTorch】RuntimeError: one of the variables needed for gradient computation has been modified by an

解决

forward()函数里面不要用:

tensor1 += 1

这样的操作

改成:

tensor1 = tensor1 + 1

都ok!

Guess you like

Origin blog.csdn.net/qq_37668436/article/details/120755846