Keras history callback loss does not match with console output of loss

Please, does anyone know why this problem described in this question (python - Keras history callback loss does not match with console output of loss - Stack Overflow) can occur? There has only been one answer to the question, which refers to a possible TensorFlow version bug, but I’m not convinced by that, especially because the OP didn’t comment on the answer. It’s happening to me too, using the LossAndErrorPrintingCallback(keras.callbacks.Callback) class and def function on_epoch_end(self, epoch, logs=None) function from this Keras guide Writing your own callbacks. I also tested the use of CSVLogger Keras callback and I also get results that differ from what appears in the model.fit() output. I’m using version 2.4.1 of TensorFlow.