using x = att.detach() didn’t work
TypeError: can't convert CUDA tensor to numpy. Use Tensor.cpu() to copy the tensor to host memory first.

But using x = detach().cpu() works.
For someone who will face the same problem
Thank you.