问题描述
在用 Keras 构建复杂的网络的过程中,报错
问题1:Type Error: unhashable type: ’ Dimension’
问题2:AttributeError: ‘Tensor’ object has no attribute ‘_keras_history’
参考链接:
05_keras入门多输入多输出模型(上)
github上此问题的讨论组
首先展示我的错误代码
train.py 部分代码
(train_x, train_y), (test_x, test_y) = datasets.cifar10.load_data()
train_x = train_x / 255.0
test_x = test_x / 255.0
train_y = train_y.flatten()
test_y = test_y.flatten()
train_y = tf.one_hot(train_y, depth=10)# raise error place, erorr 1
test_y = tf.one_hot(test_y, depth=10)# raise error place
print(train_x.shape, train_y.shape, test_x.shape, test_y.shape)
model_input = Input(shape=(32, 32, 3))
model = LENET(model_input, Convway=convway, Poolingway=poolingway)
model.summary()
model.compile(optimizer='adam', loss='categorical_crossentropy', metrics=['acc'])
history = model.fit(x=train_x, y=train_y, batch_size=50, verbose=1</