我想在密集层之前向我的双向LSTM神经网络添加其他功能
inp = Input(shape= (lags, n_features), name='input')
# create and fit the LSTM network
x = Bidirectional(LSTM(neuronsl1,activation = 'tanh' ,return_sequences=True),input_shape=(lags,n_features))(inp)
x = Dropout(0.2) (x)
x = Bidirectional(LSTM(neuronsl2, activation = 'tanh'),input_shape=(lags, n_features))(x)
x = Dropout(0.2) (x)
#additional features
af_input = Input(shape= (add_features_train.shape[1],), name='af_input')
x = Concatenate()([x, af_input])
x = Dense(neuronsl3)(x)
x = Dense(neuronsl4)(x)
output = Dense(1, name = 'output') (x)
mdl = Model(inputs=[inp, af_input], outputs = output)
mdl.compile(loss='mean_squared_error', optimizer='adam')
我要连接的两个张量的形状是(?,40)和(?,1)。我得到的是以下错误:'Tensor'对象没有属性'ndim'。 您是否有关于如何解决此问题的想法,或有关如何串联其他功能的其他想法?