Solved by ptrblck in post #4 
              
              
                No, this won’t work and you would have to use: 
os.environ['CUDA_LAUNCH_BLOCKING'] = 1

at the beginning of your script. Make sure to restart the runtime and set this env var before PyTorch or any other library was imported otherwise this variable might not have any effect.