Based on the stacktrace the blocking launch env variable doesn’t seem to be set or didn’t work properly, so you could either run the code on the CPU or synchronize manually the script (via torch.cuda.synchronize()) to further isolate the invalid index. Alternatively, using assert statements to check the input to indexing operations might also work.