Keras + tensorflow gives the error “no attribute 'control_flow_ops'”

后端 未结 3 1925
情深已故
情深已故 2020-12-14 21:36

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

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

and then

相关标签:
3条回答
  • 2020-12-14 21:46

    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
    

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

    0 讨论(0)
  • 2020-12-14 21:55

    If not Using TensorFlow 1.0.0; use tf.python_io in later versions

    import tensorflow as tf 
    
    tf.python_io.control_flow_ops = tf
    
    0 讨论(0)
  • 2020-12-14 22:03

    I got this problem when it turns out keras was using the Theano backend. To fix it do one of these:

    • In ~/.keras/keras.json set "backend": "tensorflow".
    • Set the environment variable KERAS_BACKEND to tensorflow.

    See Keras backend documentation for more information.

    0 讨论(0)
提交回复
热议问题