@rafaela00castro, @ptrblck …thank you for the discussion, very helpful.
I am trying to convert a Keras model to PyTorch…but even when setting up the initializers (weights & bias to 0) as suggested here, the loss remains slightly different between the 2 frameworks. I turned off all callbacks (LearningRate scheduler) in the keras implementation. Also, the batch (size=8) and is made of the same image repeated 8 times (so that at every step, the keras and Pytorch models use the same example - prevent differences because of data shuffling). Here are the results:
PyTorch
Epoch 1/10: loss=0.589
Epoch 2/10: loss=0.589
Epoch 3/10: loss=0.589
Epoch 4/10: loss=0.589
Epoch 5/10: loss=0.589
Epoch 6/10: loss=0.589
Epoch 7/10: loss=0.589
Epoch 8/10: loss=0.588
Epoch 9/10: loss=0.588
Epoch 10/10: loss=0.588

Keras
Epoch 1/10: loss=0.5892
Epoch 2/10: loss=0.5892
Epoch 3/10: loss=0.5892
Epoch 4/10: loss=0.5892
Epoch 5/10: loss=0.5892
Epoch 6/10: loss=0.5892
Epoch 7/10:  loss=0.5891
Epoch 8/10:  loss=0.5891
Epoch 9/10: loss=0.5891
Epoch 10/10: loss=0.5891

The 2 implementations start at about the same loss, but the Pytorch model loss decreases faster. I just wonder whether the differences in the output of the 2 models are marginal (when converting models between 2 frameworks), or  the loss values should better match. Thank you.