keras模型输出层希望输出的shape是(None,1)但我写的模型输出一个三维的shape(None,10,1)

图片说明

图片说明

### model
taxi_id = Input(shape=(10, 1))
mask_1 = Masking(mask_value=0)(taxi_id)
embedding_1 = Embedding(15000, 14, mask_zero=True)(mask_1)
time_id = Input(shape=(10, 1))
mask_2 = Masking(mask_value=0)(time_id)
embedding_2 = Embedding(7, 4, mask_zero=True)(mask_2)
busy = Input(shape=(10, 1))
mask_3 = Masking(mask_value=0)(busy)
embedding_3 = Embedding(2, 2, mask_zero=True)(mask_3)
concatenate_1 = Concatenate(axis=3)([embedding_1,embedding_2,embedding_3])
concatenate_1 = Lambda(dim_squeeze)(concatenate_1)
num_input = Input(shape=(10, 3))
mask_4 = Masking(mask_value=0, input_shape=())(num_input)
concatenate_2 = Concatenate(axis=2)([concatenate_1, mask_4])
blstm_1 = Bidirectional(LSTM(64,  activation='tanh', return_sequences=True, dropout=0.2, recurrent_dropout=0.2))(concatenate_2)
blstm_2 = Bidirectional(LSTM(128,  activation='tanh', return_sequences=True, dropout=0.2, recurrent_dropout=0.2))(blstm_1)
blstm_3 = Bidirectional(LSTM(64,  activation='tanh', return_sequences=True, dropout=0.2, recurrent_dropout=0.2))(blstm_2)
dense_1 = Dense(128)(blstm_3)
leaky_relu_1 = advanced_activations.LeakyReLU(alpha=0.3)(dense_1)
dense_2 = Dense(128)(leaky_relu_1)
leaky_relu_2 = advanced_activations.LeakyReLU(alpha=0.3)(dense_2)
dense_3 = Dense(128)(leaky_relu_2)
leaky_relu_3 = advanced_activations.LeakyReLU(alpha=0.3)(dense_3)
dense_4 = Dense(128)(leaky_relu_3)
leaky_relu_4 = advanced_activations.LeakyReLU(alpha=0.3)(dense_4)
add_1 = add([leaky_relu_1, leaky_relu_2, leaky_relu_3, leaky_relu_4])
dense_5 = Dense(1)(add_1)
model = Model([taxi_id, time_id, busy, num_input], dense_5)

求教大佬该怎么写能把输出维度降下来

1个回答

qq_31247017
孔橙 emmm不是怎么查看outputshape而是怎么把shape改成我指定的维度,大佬有办法吗
大约一年之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问