This repository has been archived by the owner on Jul 10, 2024. It is now read-only.
The problem with tf.compat.v1.disable_v2_behavior
#1008
Labels
python
Pull requests that update Python code
Description
When importing some
tensorflow_v2
modules, the subsequent TF2 functions cannot work properly.I found out that some modules call the
tensorflow.disable_v2_behavior
function when they are imported. It will disable the subsequent TF2 behaviors.Furthermore, without the
tensorflow.disable_v2_behavior
, the tests still work as usual. Maybe thedisable_v2_behavior
is not necessary to the tf2 modules.In summary, We should remove the
tf.compat.v1.disable_v2_behavior
statements to avoid the similar problem.How to reproduce the TF2 error
Create Python venv.
Create
demo.py
and copy the following Python code into it.Running the Python code. the error message shows that the TF2 function cannot work properly.
The text was updated successfully, but these errors were encountered: