The stack trace might point to an invalid index and you could rerun the code via:
CUDA_LAUNCH_BLOCKING=1 python script.py args

to see if this is indeed the line of code raising the error.
Also, if you run the code on the CPU you might get a better error message.