Funnily enough, I am not able to reproduce this in stable or nightly any more.
I first encountered this while training a model to predict flow and warp an image as above. At one point, it gave me the “illegal memory access error”. And that error sustained in later commands with cuda tensors. Even after I restarted the python environment, data transfer from CPU to GPU (using .to(torch.device('cuda'))) was extremely slow. And my screen display was getting stuck repeatedly (same GPU is handling display on my laptop). I have rebooted my laptop, and now things are working fine again. (Just to let the information be recorded)
Still not sure why the “illegal memory access error” was encountered though. Do you think it might be because it encountered a nan or inf value in flow? Thoughts?