An indexing operation fails with:
Assertion `srcIndex < srcSelectDimSize`

You could rerun the code with CUDA_LAUNCH_BLOCKING=1 python script.py args to get the line of code, where this indexing is performed.