Variable modified by an inplace operation error although using non-inplace operation

Hi Sam!

The point here is that sqrt() saves its output, rather than its input, for
use in the backward pass. (sqrt (x) could save its input, x, but then
in would have to recompute sqrt (x) from x in order to compute its
gradient. To be a little more efficient, it stores its output, sqrt (x),
instead.)

Try modifying sqrt (x)'s output, y, inplace, and see what happens.

Here is a post that goes through a few more examples of this sort of
thing:

Best.

K. Frank

1 Like