Trying to learn the encoder-decoder model for some NLP problems.

I am referring to this Keras tutorial.

During the model training phase, this tutorial just uses the following:

model.fit([encoder_input_data, decoder_input_data], decoder_target_data,

I understand this logic. But the confusion is in some other tutorials for EXACTLY THE SAME PROBLEM. For example, in Tensorflow's documentation for NMT with Attention the training_phase is very different where they use custom training loops with a custom train step and calling the step for every batch manually.

The question is are these 2 different training methods which should be used in particular cases OR its the same training method with 2 different forms of implementation?


1 Answer 1


One is a straight forward use of API while the other one gives you much better control on training. If you are experimenting, it is good to go with a custom training loop so you can control the various things that happen to your model's training.

But, if you want to just train a model and not experiment with it much, save time and go for the straight forward method of training.

Both are same but one gives you much more control.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.