简体   繁体   中英

Tensorflow: AttributeError: module 'tensorflow.python' has no attribute 'control_flow_ops'

I'm using keras ver 1.0.8 and tensorflow ver 0.12.0 . I ran python image_zooms_training.py -n 0 then it throws

`AttributeError: module 'tensorflow.python' has no attribute 'control_flow_ops'

please tell me how to solve . thank you for your help.

Following import works. You need to update that line

from tensorflow.python.ops import control_flow_ops

Official TensorFlow Support discourages use of tf.python.* as it is private and intended for development purposes only. While it may work in some cases, it will "break unannounced" in many others.

Instead, try importing tensorflow with the .python portion removed, eg:

from tensorflow.keras.models import Sequential

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM