The code you provide looks fine; I run it just now, and there is no error occurred. If possible, you can launch a new terminal to try again or provide more detailed information about your exp env, like torch version.