pytroch 模型设置成half后,使用Adam,loss出现Nan

解决办法:

   eps 改为 1e-4

(默认的1e-8在half下会round成0,除以0时会出现Nan)

你可能感兴趣的:(pytroch 模型设置成half后,使用Adam,loss出现Nan)