运行keras模型后无法绘制?

时间:2019-04-28 15:14:20

标签: python tensorflow keras

我创建了一个具有1个隐藏层的简单网络。我可以运行模型,但运行后将无法绘图。像plt.plot([1,2,3])这样简单的东西不再显示,而只是冻结了我的jupyter笔记本。

from keras.layers import Input, Dense
from keras.models import Model

x = Input(shape=(13,))
h = Dense(units= 3, activation = 'relu')(x)
y = Dense(units=1,activation= None)(h)
model = Model(x, y)

model.fit(x=x_train, y=y_train,
validation_data=(x_test, y_test),
batch_size=16,
epochs=50)

上面的方法工作正常,但是现在尝试进行操作

import matplotlib.pyplot as plt
plt.plot([2,3,4,5])

例如,我的代码笔记本冻结,我必须重新启动内核。这很奇怪,我找不到任何有类似问题的人。我尝试卸载keras并重新安装无济于事。

如果相关的话,我导入喀拉拉邦时就得到

/anaconda2/lib/python2.7/site-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.
从._conv中的

导入register_converters作为_register_converters 使用TensorFlow后端。

0 个答案:

没有答案