I am trying to perform row wise and column wise max pooling over an attention layer as described in the link below: http://www.dfki.de/~neumann/ML4QAseminar2016/presentations/Attentive-Pooling-Network.pdf (slide-15)
I am using text dataset where a sentence is fed to CNN. Each word of the sentence has been embedded. The code for it is as below:
model.add(Embedding(MAX_NB_WORDS, emb_dim, weights=[embedding_matrix],input_length=MAX_SEQUENCE_LENGTH, trainable=False))
model.add(Conv1D(k, FILTER_LENGTH, border_mode = "valid", activation = "relu"))
The output from the CNN is of shape (None, 256). This act as an input to attention layer. Can anyone suggest how to implement the row wise or column wise max-pooling in keras with tensorflow as the backend?