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)

l_merge = Merge(mode='concat', concat_axis=1)(convs)

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


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 | |

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.