Tag Archives: one of the variables needed for gradient computation has been modified by an inplace operation

one of the variables needed for gradient computation has been modified by an inplace operation

Reference: https://www.cnblogs.com/liangzp/p/9207979.html

When using a model written in Python, an error is reported: runtimee rror:one of the variables needed for gradient computation has been modified by an inplace operation

Solution 1: if you are using pytorch0.4.0, go back to pytorch0.3.0

Solution 2: if there is an inreplace parameter, set it to false

Solution 3: the reason for the error is that since Python version 0.4.0 does not support inplace operation, all inplace errors are removed