lutego 27, 2019 —
Posted by Paige Bailey and Anna Revinskaya
TensorFlow 2.0 will include many API changes, such as reordering arguments, renaming symbols, and changing default values for parameters. Manually performing all of these modifications would be tedious, and prone to error. To streamline the changes, and to make your transition to TF 2.0 as seamless as possible, the TensorFlow engineering team has created…
tf_upgrade_v2
utility that will help transition legacy code to the new API.tf_upgrade_v2
utility is included automatically with a pip install of TF 2.0, and will help accelerate your upgrade processes by converting existing TensorFlow 1.13 Python scripts to TensorFlow 2.0.compat.v1
module. This module will replace calls of the form tf.foo
with equivalent tf.compat.v1.foo
references. It is recommended, however, to manually proofread such replacements and migrate them to new APIs in tf.*
namespace instead of tf.compat.v1.*
namespace as quickly as feasible.tf.flags
and tf.contrib
), TensorFlow 2.0 will include changes that cannot be worked around by switching to compat.v1
. Upgrading code that uses these modules might require using an additional library (for e.g. absl.flags
) or switching to a package in tensorflow/addons.tf-nightly-2.0-preview
/ tf-nightly-gpu-2.0-preview
.tf_upgrade_v2
is installed automatically by pip install for TensorFlow 1.13 and later (incl. the nightly 2.0 builds).tf_upgrade_v2 — infile foo.py — outfile foo-upgraded.py
# upgrade the .py files and copy all the other files to the outtree
tf_upgrade_v2 — intree foo/ — outtree foo-upgraded/
# just upgrade the .py files
tf_upgrade_v2 — intree foo/ — outtree foo-upgraded/ — copyotherfiles
False
report.txt
file that will be exported to your current directory. Once tf_upgrade_v2
has run and exported your upgraded script, you can run your model and check to ensure your outputs are similar to TF 1.13:Caveats:
tf.argmax
or tf.batch_to_space
cause the script to incorrectly add keyword arguments that mismap your existing code.To report upgrade script bugs or make feature requests, file an issue on GitHub — and if you’re testing TensorFlow 2.0, we want to hear about it! Please feel free to join the TF 2.0 Testing community and send questions and discussion to testing@tensorflow.org.
lutego 27, 2019
—
Posted by Paige Bailey and Anna Revinskaya
TensorFlow 2.0 will include many API changes, such as reordering arguments, renaming symbols, and changing default values for parameters. Manually performing all of these modifications would be tedious, and prone to error. To streamline the changes, and to make your transition to TF 2.0 as seamless as possible, the TensorFlow engineering team has created…