我正在使用Python 2.7.5跟踪tf.keras
tutorial,但是model.fit(data, labels, epochs=10, batch_size=32)
给了我错误消息:
>>> model.fit(data, labels, epochs=10, batch_size=32,validation_data= (val_data, val_labels))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/software/TensorFlow/1.8-GPU-py2/lib/python2.7/site-packages/tensorflow/python/keras/_impl/keras/engine/training.py", line 1143, in fit
batch_size=batch_size)
File "/software/TensorFlow/1.8-GPU-py2/lib/python2.7/site-packages/tensorflow/python/keras/_impl/keras/engine/training.py", line 751, in _standardize_user_data
feed_input_names = self._feed_input_names
AttributeError: 'Sequential' object has no attribute '_feed_input_names'
谁能指出出什么问题了?
答案 0 :(得分:0)
我遇到了同样的问题,不知道为什么,我没有搜索它,但是当我添加了这种浮石时 input_shape =(高度,宽度,通道)到我的第一层网络,错误消失了。
model = keras.models.Sequential()
model.add(firstLayer(....., input_shape=(height,width,channels))
我希望它也会对您有帮助。