This chapter covered two ways to convert TF 1.x code into TF 2.0 code. The first way is to use the included upgrade script, which changes all API calls from tf.x to tf.compat.v1.x. This allows TF 1.x code to run in TF 2.0, but will not benefit from the upgrades that were brought in TF 2.0. The second way is to change TF 1.x to idiomatic TF 2.0 code, which involves two steps. The first step is to change all model creation code into TF 2.0 code, which involves changing tensors using sess.run calls into functions, and placeholders and feed dicts into arguments for the function. Models that are created using the tf.layers API have a one-to-one comparison to tf.keras.layers. The second step is to upgrade the training pipeline by using either tf.keras.Model.fit or a custom training loop with tf.GradientTape.
TF 2.0 brings many changes in the way TensorFlow code is written and...