【发布时间】:2019-06-04 00:30:26
【问题描述】:
我在以下代码中遇到错误
flatten = Flatten()(drop_5)
aux_rand = Input(shape=(1,))
concat = Concatenate([flatten, aux_input])
fc1 = Dense(512, kernel_regularizer=regularizers.l2(weight_decay))(concat)
ValueError: Layer dense_1 被调用的输入不是 符号张量。接收类型:.完整输入:[]。所有输入到 层应该是张量。
(x_train, y_train), (x_test, y_test) = cifar10.load_data()
x_train = x_train.astype('float32')
x_test = x_test.astype('float32')
aux_rand = np.random.rand(y_train.shape[0])
model_inst = cifar10vgg()
x_train_input = Input(shape=(32,32,3))
aux_input = Input(shape=(1,))
model = Model(inputs=[x_train_input, aux_input], output=model_inst.build_model())
model.fit(x=[x_train, aux_rand], y=y_train, batch_size=batch_size, steps_per_epoch=x_train.shape[0] // batch_size,
epochs=maxepoches, validation_data=(x_test, y_test),
callbacks=[reduce_lr, tensorboard], verbose=2)
model_inst.build_model() 返回模型最后一层的输出 (Activation('softmax')(fc2))
【问题讨论】:
标签: tensorflow keras conv-neural-network