The tf.keras.Model object, through its compile and fit methods, allows you to train a great number of machine learning models, from classifiers to generative models. The Keras way of training can speed up the definition of the training phase of the most common models, but the customization of the training loop remains limited.
There are models, training strategies, and problems that require a different kind of model training. For instance, let's say we need to face the gradient explosion problem. It could happen that, during the training of a model using gradient descent, the loss function starts diverging until it becomes NaN because of the size of the gradient update, which becomes higher and higher until it overflows. ...