Solved by ptrblck in post #8 
              
              
                Thanks for the code snippet. 
I cannot reproduce the issue using a source build with: 
torch.__version__
'1.9.0a0+git6d45d7a'

torchvision.__version__
'0.11.0a0+882e11d'

and the optimization step doesn’t raise an error, so you might want to update to the latest nightly binary (or build from source)…