@jpj Your inputs doesn’t have to be nan for you to get nan errors. LogSoftMax has a log term, denominator, and exponential term.
For example, the exponential term overflows for very large input and underflows for very negative inputs. Both will show nan error.
Is that the case here @ptrblck ?