I think it is generally safe. You only get the exception when PyTorch “returns to Python” in the sense that Python does not interrupt until after PyTorch reached a state in which it is OK to do so.
That said, I have read that parallel processing can be sensitive to error modes in that there may be cases in which the spawned cihild-processes are not properly terminated.
Best regards
Thomas