Upgrading training loops

The second step of converting TF 1.x code into idiomatic TF 2.0 code is to upgrade the training pipelines. TF 1.x training pipelines involve multiple tf.Session.run() calls for the optimizer, losses, and predictions. Such training loops also involve boilerplate code that's written to log the training results to the console for easy supervision.

In TF 2.0, three types of training loops can be used. Each of these loops has different advantages and disadvantages and varies in difficulty, API level, and complexity. They are as follows:

  • The first type of training loop is tf.keras.Model.fit(). This is a built-in training loop that handles all the aspects of training and provides a uniform interface for all kinds of Keras ...

Get What's New in TensorFlow 2.0 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.