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)
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
@KFrank Quite detailed. Thanks!