Could you rerun the code with CUDA_LAUNCH_BLOCKING=1 python script.py args and post the stack trace here?
The cudnn error seems to be a red herring, as an indexing kernel seems to be creating the actual error.
Also, if you are on an older PyTorch version, could you update it to the latest stable version?