Inplace operation error in multiplication

I got the following error:

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

with anomaly detection enabled, the last line of “traceback of the forward call that caused the error” is

num = (1 + 2 * c * xy + c * y2) * x + (1 - c * x2) * y
(function _print_stack)
Traceback (most recent call last):

Error detected in MulBackward0. y has the same shape as the variable modified. If I understand this correctly, it seems the error is in ‘* y’. I don’t understand how ’ * ’ could modify ‘y’ inplace.

BTW c is a scalar tensor, and this multiplication is broadcasted.

Hope this is enough information. Thanks in advance.

What happens is that backprop reaches this line doing MulBackward and detects that some multiplicand is no longer available (overwritten). So inplace operation is happening somewhere later, this is just a detection point.