It is the same as if you’re doing:
a = torch.rand(10, requires_grad=True)
b = a + 1

b.sum().backward()

Then b.grad will be None.
The same thing happens if you replace the + 1 op by .cuda().
It is handled like any other differentiable operation on Tensor.