Describe
Recently, I found that I can not initialize a random int tensor with randint
while requires_grad
is set to True.
To Reproduce
torch.randint(1, (10, 10), requires_grad=True)
RuntimeError: Only Tensors of floating point and complex dtype can require gradients
Additional information
- Windows 10
-
torch
version 1.9.0 -
python
version 3.9.6