The previous issues were isolated by rerunning the code with CUDA_LAUNCH_BLOCKING=1 python script.pt args, which should print a stack trace with the line of code causing the issue.
As described in post, the failing operation was an out-of-bounds index, so the cudnn error was a red herring and was raised due to the asynchronous execution of CUDA operations.
Rerun the script with the mentioned env variable or rerun it on the CPU, which should also give you a clear error message.