0
$\begingroup$
embedding_layer = Embedding(nb_words, self.embedding_dim, weights=[embedding_matrix],
                                input_length=self.max_sequence_length, trainable=False)

    # Creating LSTM Encoder
    lstm_layer = Bidirectional(LSTM(self.number_lstm_units, dropout=self.rate_drop_lstm, recurrent_dropout=self.rate_drop_lstm ))

    # Creating LSTM Encoder layer for First Sentence
    sequence_1_input = Input(shape=(self.max_sequence_length,), dtype='int32')
    embedded_sequences_1 = embedding_layer(sequence_1_input)
    x1 = lstm_layer(embedded_sequences_1)

    # Creating LSTM Encoder layer for Second Sentence
    sequence_2_input = Input(shape=(self.max_sequence_length,), dtype='int32')
    embedded_sequences_2 = embedding_layer(sequence_2_input)
    x2 = lstm_layer(embedded_sequences_2)

    # Creating leaks input
    leaks_input = Input(shape=(leaks_train.shape[1],))
    leaks_dense = Dense(int(self.number_dense_units/2), activation=self.activation_function)(leaks_input)
    # Merging two LSTM encodes vectors from sentences to
    # pass it to dense layer applying dropout and batch normalisation
    concatInput = concatenate([x1, x2, leaks_dense],axis=-1)
    conv2DDim = (300,300,1,4)
    concatInput = Reshape(target_shape=conv2DDim, name='reshapelstmtoconv')(concatInput)
    # concatInput = K.expand_dims(concatInput)
    # creating conv1d for input 1
    conv_layer1 = Conv2D(filters=300, kernel_size=3, padding="valid" ,activation="relu")(concatInput)
    conv_layer2 = Conv2D(filters=300, kernel_size=4, padding="valid",activation="relu")(concatInput)
    conv_layer3 = Conv2D(filters=300, kernel_size=5, padding="valid",activation="relu")(concatInput)
    conv_layer4 = Conv2D(filters=300, kernel_size=10, padding="valid",activation="relu")(concatInput)

Shape of concatInput is (None, 450) and I want to put it for Conv2d but I could, Conv2d with input is 4Dim, please help me, thank a alot.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.