Keras that does not support TensorFlow 2.0. We recommend using `tf.keras`, or alternatively, downgrading to TensorFlow 1.14

前端 未结 7 1580
孤独总比滥情好
孤独总比滥情好 2021-02-13 15:41

I am having an error regarding (Keras that does not support TensorFlow 2.0. We recommend using tf.keras, or alternatively, downgrading to TensorFlow 1.14.) any reco

相关标签:
7条回答
  • 2021-02-13 15:55

    if you want to use tensorflow 2.0+ you must have keras 2.3+
    try to upgrade your keras it works for me :

    pip install -U keras
    

    or you may specify the keras version to 2.3

    0 讨论(0)
  • 2021-02-13 15:59

    I fixed the problem by running

    pip install --ignore-installed --upgrade keras
    
    0 讨论(0)
  • 2021-02-13 16:01

    TensorFlow 2.0+ is only compatible with Keras 2.3.0+, so if you wish to use Keras 2.2.5-, you'll need TensorFlow 1.15.0-. Alternatively, yes, you can do from tensorflow.keras import ..., but that will not use your keras package at all and you might as well uninstall it.

    0 讨论(0)
  • 2021-02-13 16:03

    I ran into the same issue. Downgraded my TensorFlow to version 1.14 using the following:

    !pip install tensorflow==1.14.0
    

    Fixed the error.

    0 讨论(0)
  • 2021-02-13 16:08

    this line of code on the first cell worked for me

    %tensorflow_version 1.x

    0 讨论(0)
  • 2021-02-13 16:15

    first, import tensorflow:

    import tensorflow as tf
    

    Next, in place of this,

    classifier.add(Dense(output_dim = 6, init = 'uniform', activation = 'relu', input_dim = 11))
    

    use:

    classifier.add(tf.keras.layers.Dense(output_dim = 6, init = 'uniform', activation = 'relu', input_dim = 11))
    

    Let me know if it works.

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