问题
I'm using CNNs in Keras
for an NLP task and instead of max pooling, I'm trying to achieve max over time pooling.
Any ideas/hacks on how to achieve this?
What I mean by max over time pooling is to pool the highest value, no matter where they are in the vector
回答1:
Assuming that your data shape is (batch_size, seq_len, features)
you may apply:
seq_model = Reshape((seq_len * features, 1))(seq_model)
seq_model = GlobalMaxPooling1D()(seq_model)
来源:https://stackoverflow.com/questions/41958115/max-over-time-pooling-in-keras