Hi,
The ** expression routes to the pow operation.
The reason why one works and not the other is because of the way the derivatives are computed:

For sqrt, for better performance, the result is reused as you can see here 15 (you don’t need to understand the semantic but the point is that result is used here).
For pow (or **), the formula is much more general as you can see here 8 and does not use result.

Both cases will give you the same result.
As you saw, since sqrt uses the value of the output, you are not allowed to modify it inplace. If you use **, the backward will be slower but since it does not use result, it can be changed inplace.
For the assignment, it will mask out some entries in the Tensor (and so no gradient will flow back for these entries) and leave the other ones intact (and so gradients will flow as expected for these ones).
Isn’t that the behavior you were expecting? If not what were you trying to achieve?