不支持TensorFlow 2.0的Keras.我们建议使用`tf.keras`,或者降级为TensorFlow 1.14 [英] Keras that does not support TensorFlow 2.0. We recommend using `tf.keras`, or alternatively, downgrading to TensorFlow 1.14
本文介绍了不支持TensorFlow 2.0的Keras.我们建议使用`tf.keras`,或者降级为TensorFlow 1.14的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
关于(建议不使用TensorFlow 2.0的Keras.我们建议使用tf.keras
,或者将其降级为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.
谢谢
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.
推荐答案
您只需要在顶部更改导入:
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))
这篇关于不支持TensorFlow 2.0的Keras.我们建议使用`tf.keras`,或者降级为TensorFlow 1.14的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文