How to upgrade using the script

The tf_upgrade.py script helps you to upgrade your 0.x source codes to 1.x (or higher) compatible. This script can be downloaded from GitHub at https://github.com/tensorflow/tensorflow/tree/master/tensorflow/tools/compatibility. To convert a single 0.x TensorFlow source file to 1.x (or higher) issue a command in following format:

For Python 2.7 type the following command:

$ python tf_upgrade.py --infile InputFile --outfile OutputFile

For Python 3.3+n type the following command:

$ python3 tf_upgrade.py --infile InputFile --outfile OutputFile 

For example, suppose you have a script named five_layers_relu.py which is 0.x compatible written on Python 2.7 with the following code:

import mnist_data  import tensorflow ...

Get Deep Learning with TensorFlow 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.