You could rerun the code on the CPU, which might give you a better stack trace or alternatively use
CUDA_LAUNCH_BLOCKING=1 python script.py args

to launch a synchronized run, which should point you to the line of code containing the out of bounds indices.