Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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 recommendations.

thanks

import keras
#For building the Neural Network layer by layer
from keras.models import Sequential
#To randomly initialize the weights to small numbers close to 0(But not 0)
from keras.layers import Dense

classifier=tf.keras.Sequential()

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




RuntimeError: It looks like you are trying to use a version of multi-backend Keras that does not support TensorFlow 2.0. We recommend using `tf.keras`, or alternatively, downgrading to TensorFlow 1.14.
like image 817
Dean Avatar asked Nov 28 '19 13:11

Dean


People also ask

What version of Keras should I use with TensorFlow?

We recommend using tf.keras, or alternatively, downgrading to TensorFlow 1.14. Sorry, something went wrong. how to solve the below error in google colab... RuntimeError: It looks like you are trying to use a version of multi-backend Keras that does not support TensorFlow 2.0.

What version of TensorFlow should I use for TFX?

Therefore, if you are starting a new TFX project, we recommend that you use TensorFlow 2.x. You may want to update your code later as full support for Keras and other new features become available, and the scope of changes will be much more limited if you start with TensorFlow 2.x, rather than trying to upgrade from TensorFlow 1.x in the future.

What is the TF keras submodule?

The tf.keras submodule was introduced in TensorFlow v1.10.0, the first step in integrating Keras directly within the TensorFlow package itself. The tf.keras package is/was separate from the keras package you would install via pip (i.e., pip install keras ).

What is the latest version of Keras for deep learning?

Keras v2.3.0 is the first release of Keras that brings keras in sync with tf.keras It will be the the last major release to support backends other than TensorFlow (i.e., Theano, CNTK, etc.) And most importantly, deep learning practitioners should start moving to TensorFlow 2.0 and the tf.keras package


1 Answers

You should only have to change the imports at the top:

from tensorflow.python.keras.layers import Dense
from tensorflow.python.keras import Sequential

classifier = Sequential()
classifier.add(Dense(6, init = 'uniform', activation = 'relu', input_dim = 11))
like image 85
nickthefreak Avatar answered Oct 07 '22 21:10

nickthefreak