Hi,
At the first iteration, it works fine.
The problem is that at the end of it, you do     x_fooling=x_fooling+dx which replaces you x_fooling leaf by a Tensor that is not a leaf anymore (it is the result of a differentiable op).
And so as suggested above, you need to make sure that this update is done in a non-differentiable way to make sure x_fooling remains a leaf. You can do so with
with torch.no_grad():
    x_fooling = x_fooling + dx