the problem is that one of your input samples during training contained a NaN value. The running_mean and running_std buffers of BatchNorm layers hence likely contain NaNs.
Because of this, in inference mode the outputs through the linear layer are NaNs.