Converting from tf1.12 to tf2

Google supplies a command-line script called  tf_upgrade_v2which converts version 1.12 files (both .py and .ipynb files) into TensorFlow 2 compatible files.

The syntax for this conversion is as follows:

 tf_upgrade_v2   --infile  file_to_convert --outfile  converted_file

There is a demonstration of this upgrade script in action at https://www.youtube.com/watch?v=JmSNUeBG-PQ&list=PLQY2H8rRoyvzoUYI26kHmKSJBedn3SQuB&index=32&t=71s, and more detailed information regarding it is available at https://github.com/tensorflow/docs/blob/master/site/en/r2/guide/upgrade.md.

It is important to note that you should not update parts of your code manually before running this script.

The script will not fix all of the issues, but ...

Get TensorFlow 2.0 Quick Start Guide 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.