Max over time pooling in Keras

浪尽此生 提交于 2019-12-23 07:47:13

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!