Problem with .detach()

If you assign a tensor to another, you will use a reference and thus manipulate both, x_backward and x1 using inplace operations.
Try to call x_backward = x1.clone() and test the code again.

Double post from here.