Question about inf and nan error

I am not quite clear about the operations that will cause inf and nan? Can you list the operations resulting in the two errors respectively? (e.g. num/0 → nan)

Hi ZiQing!

inf and nan are not really specific to pytorch (or python, for that matter),
but are, rather, part of essentially all modern floating-point arithmetic
implementations (of which almost all essentially follow the IEEE-754
floating-point standard).

For discussions of the inf and nan rules, see, for example, Wikipedia’s
Special values and Operations generating NaN.


K. Frank

@KFrank Quite detailed. Thanks!