Good to hear it’s working.
However, note that you are creating a non-leaf tensor with the cuda
call as described by @albanD here, so you would probably want to create the tensor as:
torch.tensor(1, dtype=torch.float, requires_grad=True, device='cuda:0')