Olorin:

Could it be related to something like the (potential) different implementations of optimizer and loss function in PyTorch and Keras?


Since you’re using SGD in both cases, the above should not be the case.

Are the loss values aligned in both cases? Is the difference only in the train time and not in loss values?
What’s your model like? Make sure that the model params are initialized to the same values (like constant values) for fair comparison.