No this won’t work.
A quick check
 a = torch.ones(10, requires_grad=True) # Works
 a = torch.ones(10, requires_grad=True, dtype=torch.long) # Error (Only Tensors of floating point can require gradient)