# Migrate to TensorFlow 2

## Migrate from TensorFlow 1.x to TensorFlow 2

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](https://www.tensorflow.org/guide/migrate/tf1_vs_tf2). Briefly, the migration process is:

1. Run the [automated script](https://www.tensorflow.org/guide/migrate/upgrade) to convert your TF1.x API usage to `tf.compat.v1`.
2. Remove old `tf.contrib.layers` and replace them with [TF Slim](https://github.com/google-research/tf-slim) symbols. Also check [TF Addons](https://www.tensorflow.org/addons) for other `tf.contrib` symbols.
3. Rewrite your [TF1.x model forward passes to run in TF2](https://www.tensorflow.org/guide/migrate/model_mapping) with eager execution enabled.
4. [Validate the accuracy and numerical correctness](https://www.tensorflow.org/guide/migrate/validate_correctness) of your migrated code.
5. Upgrade your [training, evaluation](https://www.tensorflow.org/guide/migrate/migrating_estimator) and [model saving](https://www.tensorflow.org/guide/migrate/saved_model) code to TF2 equivalents.
6. (Optional) [Migrate your TF2-compatible `tf.compat.v1` APIs](https://www.tensorflow.org/guide/migrate/model_mapping#incremental_migration_to_native_tf2) including [TF Slim](https://github.com/google-research/tf-slim) usage to idiomatic TF2 APIs.

### Featured migration guides

[### TensorFlow 1.x vs TensorFlow 2](https://www.tensorflow.org/guide/migrate/tf1_vs_tf2) Learn how the TF2 API and behaviors differ fundamentally from TF1.x. [### Map TF1.x models to TF2](https://www.tensorflow.org/guide/migrate/model_mapping) Begin using TF1.x models in TF2 right away using modeling shims. [### Rewrite TF1.x API symbols](https://www.tensorflow.org/guide/migrate/upgrade) Programmatically upgrade some parts of your TF1.x code to TF2. [### Validate migrated TF2 code](https://www.tensorflow.org/guide/migrate/validate_correctness) Verify the correctness of your migrated TF2 code. [### Moving off Estimators](https://www.tensorflow.org/guide/migrate/migrating_estimator) Migrate from your Estimator training pipelines to TF2. [### Moving off feature columns](https://www.tensorflow.org/guide/migrate/migrating_feature_columns) Learn how to migrate to Keras preprocessing layers from `tf.feature_column`s. [### Multi-worker CPU/GPU training workflows](https://www.tensorflow.org/guide/migrate/multi_worker_cpu_gpu_training) Learn how to migrate multi-worker distributed `Estimator` to TF2. [### TPU workflows](https://www.tensorflow.org/guide/migrate/tpu_estimator) Learn how to migrate the `TPUEstimator` API to TF2. [### TensorFlow Lite](https://www.tensorflow.org/guide/migrate/tflite) Learn how to migrate TF Lite code created with TF1.x to TF2.