fengqh:

how to deal with this problem


use a debugger, ensure that your loss (forward output) contains non-finite values (perhaps at some epoch > 1), re-run forward() step-by-step to find the problem (you can use conditional breakpoints and “jump to cursor” in pycharm’s debugger). Sorry, I cant think of an easier way.