Hi,
You won’t be able to make a long Tensor require gradients.
And even if you trick pytorch into doing it, no differentiable op is implemented for integer types so you will have to reimplement everything.
Also, keep in mind that the indexing op is not differentiable. Even if you try to compute gradients for it, you will just get 0 everywhere which is not very usefull.