You are welcome,
Ok, nightly builds may have some bugs or differences which I am not aware of. I ran your code and there was no problem using the stable build. Can you try to run your code using exact same pytorch version on google colab and share it?
Can you also print the full stack trace?