本文介绍了Keras + tensorflow给出了错误"no attribute'control_flow_ops'".的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我第一次尝试运行keras.我使用以下命令安装了模块:

I am trying to run keras for the first time. I installed the modules with:

pip install keras --user
pip install tensorflow --user

,然后尝试运行 https://github.com/fchollet/keras/blob/master/examples/mnist_cnn.py .

但是它给了我

AttributeError: 'module' object has no attribute 'control_flow_ops'

这些是我正在使用的版本.

These are the versions I am using.

print tensorflow.__version__
0.11.0rc0
print keras.__version__
1.1.0

推荐答案

Keras和TF之间存在问题,可能tf.python.control_flow_ops不存在或不再可见. 使用下面的导入语句,您可以解决此问题

There is an issue between Keras and TF, Probably tf.python.control_flow_ops does not exist or not visible anymore. using below import statements you can resolve this issue

import tensorflow as tf
tf.python.control_flow_ops = tf

有关详细信息,请检查: https://github.com/fchollet/keras/issues/3857

For Details check:https://github.com/fchollet/keras/issues/3857

这篇关于Keras + tensorflow给出了错误"no attribute'control_flow_ops'".的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-29 05:09