RuntimeError: norm(): input dtype should be either floating point or complex dtypes. Got Long instea

**RuntimeError: norm(): input dtype should be either floating point or complex dtypes. Got Long instead.

Error when using norm

Known by translation "input dtype should be floating point or complex dtypes"

The code and error are as followsinsert image description hereinsert image description here

Just change the data type, that is, add "dtype=torch.float"

insert image description here
insert image description here

Guess you like

Origin blog.csdn.net/qq_44961737/article/details/125354930