CNTK icon indicating copy to clipboard operation
CNTK copied to clipboard

Is there anyway to implement MaxPooling for an sequence since ReduceMax does not support for sequence?

Open 1026112881 opened this issue 9 years ago • 1 comments

1026112881 avatar Feb 09 '17 11:02 1026112881

If you want a global max pooling, there is now a sequence.reduce_max.

If you want max pooling over a windows of 3 tokens/frames then you can do the following:

p = C.sequence.past_value(x)
n = C.sequence.future_value(x)
window = C.splice(p, x, n, axis=C.Axis.new_leading_axis())
result = C.reshape(C.reduce_max(window, axis=0), (x.shape))

Here window is a sequence of 3 x d tensors where d was the shape of x. The result is just taking a maximum over 3 values the previous, the current one and the next one and reshaping to the shape of x.

You can easily extend this code to support larger windows.

Feel free to reopen this thread if you have followup questions.

n17s avatar Aug 23 '17 01:08 n17s