2
$\begingroup$

How to replace the merge statement in newer version of keras. Newer version of keras doen't support the Merge.

for fsz in filter_sizes:
    l_conv = Conv1D(nb_filter=128,filter_length=fsz,activation='relu')(embedded_sequences)
    l_pool = MaxPooling1D(5)(l_conv)
    convs.append(l_pool)

l_merge = Merge(mode='concat', concat_axis=1)(convs)
$\endgroup$
3
$\begingroup$

This changed a while ago. Now you can use the concatenate layer. Documentation says:

keras.layers.concatenate()

Definition: concatenate(inputs, axis=-1, **kwargs)

Type: Function of keras.layers.merge module

Functional interface to the Concatenate layer.

Arguments→ inputs: A list of input tensors (at least 2). axis: Concatenation axis. **kwargs: Standard layer keyword arguments.

Returns→ A tensor, the concatenation of the inputs alongside axis axis.

Since you are using the Functional API:

from keras.layers import concatenate
l_merge = concatenate(convs, axis=1)
| improve this answer | |
$\endgroup$

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.