Learn how to migrate your TensorFlow code from TensorFlow 1.x to TensorFlow 2. It may take a little work to convert your code, but every change results in access to new features and models, increased clarity and simplicity, and easier debugging. Before starting to migrate, read the behaviors guide. Briefly, the migration process is:
- Run the automated script to convert your TF1.x API usage to
- Remove old
tf.contrib.layersand replace them with TF Slim symbols. Also check TF Addons for other
- Rewrite your TF1.x model forward passes to run in TF2 with eager execution enabled.
- Validate the accuracy and numerical correctness of your migrated code.
- Upgrade your training, evaluation and model saving code to TF2 equivalents.
- (Optional) Migrate your TF2-compatible
tf.compat.v1APIs including TF Slim usage to idiomatic TF2 APIs.