Converting TF 1.x models

The first step is to replace all calls with a Python function. This means turning tf.placeholder and feed_dict into function arguments. These become the function's return value. This change means that standard Python tools such as pdb can be used to step through and debug the function, unlike TF 1.x. Once the function has been built, the tf.function annotation can be added to run the function in graph mode, along with the efficiency of the equivalent calls in TF 1.x.

TF 1.x models that are created using the tf.layers API can be converted into TF 2.0 with relative ease. The tf.layers module was used to contain layer functions that relied on tf.variable_scope to define and reuse variables. ...

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.