To verify is not an OS specific problem I also tested the code above on a different machine with Windows 10 (using peterjc123’s conda package of PyTorch for Windows) and the issue persists.
Disabling all forms of code introspection and inline variables visualization in PyCharm doesn’t seem to help either.