python - 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.
解决方案
您应该只需要更改顶部的导入:
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))
推荐阅读
- javascript - jQuery slideDown 仅在重新加载后第一次回弹
- python - pytest 函数不返回要在同一 pytest 文件中的以下函数中使用的数据?
- pyomo - Gurobipy vs Pyomo 差异
- c# - 蒙哥。C#。我如何执行字符串作为 mongo 查询
- c# - Json Deserialise 与明显相同的数据不一致
- node.js - 使用 Node api 的响应时间
- mysql - MySQL中ED50转WGS84的问题
- flutter - 颤振:StreamBuilder 不接受合并流
- python - 如何在 FFT 后获得数据对应的频率值?
- python-3.x - Python添加列条件未按预期工作