简体   繁体   English

Tensorflow:AttributeError:模块'tensorflow.python'没有属性'control_flow_ops'

[英]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 .我正在使用 keras 版本1.0.8和 tensorflow 版本0.12.0 I ran python image_zooms_training.py -n 0 then it throws我跑了python image_zooms_training.py -n 0然后它抛出

`AttributeError: module 'tensorflow.python' has no attribute 'control_flow_ops' `AttributeError:模块'tensorflow.python'没有属性'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.官方 TensorFlow 支持不鼓励使用 tf.python.*,因为它是私有的并且仅用于开发目的。 While it may work in some cases, it will "break unannounced" in many others.虽然它在某些情况下可能有效,但在许多其他情况下它会“突然中断”。

Instead, try importing tensorflow with the .python portion removed, eg:相反,请尝试在删除 .python 部分的情况下导入 tensorflow,例如:

from tensorflow.keras.models import Sequential

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Keras + tensorflow给出错误“无属性'control_flow_ops'” - Keras + tensorflow gives the error “no attribute 'control_flow_ops'” AttributeError: 模块“tensorflow.python.framework.ops”没有属性“RegisterShape” - AttributeError: module 'tensorflow.python.framework.ops' has no attribute 'RegisterShape' AttributeError:模块'tensorflow.python.framework.ops'没有属性'_TensorLike' - AttributeError: module 'tensorflow.python.framework.ops' has no attribute '_TensorLike' Tensorflow模块导入错误:AttributeError:模块'tensorflow.python.ops.nn'没有属性'rnn_cell' - Tensorflow Module Import error: AttributeError: module 'tensorflow.python.ops.nn' has no attribute 'rnn_cell' tensorflow 中的 add 方法问题:AttributeError: module 'tensorflow.python.framework.ops' has no attribute '_TensorLike' - Issue with add method in tensorflow : AttributeError: module 'tensorflow.python.framework.ops' has no attribute '_TensorLike' Tensorflow:AttributeError:模块“tensorflow.python.ops.nn”没有属性“softmax_cross_entropy_with_logits_v2” - Tensorflow: AttributeError: module 'tensorflow.python.ops.nn' has no attribute 'softmax_cross_entropy_with_logits_v2' AttributeError:模块'tensorflow.python.framework.op_def_registry'没有属性'get_registered_ops' - AttributeError: module 'tensorflow.python.framework.op_def_registry' has no attribute 'get_registered_ops' AttributeError:模块“ tensorflow.contrib.learn.python.learn.ops”没有属性“ split_squeeze” - AttributeError: module 'tensorflow.contrib.learn.python.learn.ops' has no attribute 'split_squeeze' AttributeError:模块“ tensorflow.python.ops.linalg.linear_operator_util”没有属性“ matmul_with_broadcast” - AttributeError: module 'tensorflow.python.ops.linalg.linear_operator_util' has no attribute 'matmul_with_broadcast' 我无法理解这个 AttributeError: module 'tensorflow.python.framework.ops' has no attribute '_TensorLike' - I cannot understand this AttributeError : module 'tensorflow.python.framework.ops' has no attribute '_TensorLike'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM