Rerun the code via CUDA_LAUNCH_BLOCKING=1 python script.py args and check which operation is causing the out-of-bounds index error. Alternatively, run the code on the CPU which should also show the failing op.