Watch talks from the 2019 TensorFlow Dev Summit Watch now

tf.enable_v2_behavior

tf.enable_v2_behavior()

Defined in tensorflow/python/compat/compat.py.

Enables TensorFlow 2.x behaviors.

This function can be called at the beginning of the program (before Tensors, Graphs or other structures have been created, and before devices have been initialized. It switches all global behaviors that are different between TensorFlow 1.x and 2.x to behave as intended for 2.x.

This function is called in the main TensorFlow __init__.py file, user should not need to call it, except during complex migrations.