Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ksize in max_pool #4746

Closed
ayushchd opened this issue Oct 4, 2016 · 11 comments · Fixed by #11875
Closed

ksize in max_pool #4746

ayushchd opened this issue Oct 4, 2016 · 11 comments · Fixed by #11875
Labels
stat:contribution welcome Status - Contributions welcome

Comments

@ayushchd
Copy link

ayushchd commented Oct 4, 2016

I am trying to build a convolution (followed by max_pool) for variable length input size. Since the length of the input in a batch should be the same, I set the batch size to 1. However, for some reason ksize in tf.nn.max_pool is a list attribute required at run-time. This would prevent any neural network that uses variable input size to apply max pool. Is there a workaround for this? Should ksize be an input tensor otherwise?

@tatatodd
Copy link
Contributor

tatatodd commented Oct 4, 2016

FYI this was also asked about in #1957

We welcome contributions!

@tatatodd tatatodd added the stat:contribution welcome Status - Contributions welcome label Oct 4, 2016
@ayushchd
Copy link
Author

ayushchd commented Oct 5, 2016

#1957 seems completely unrelated. Am I missing something?

@tatatodd
Copy link
Contributor

tatatodd commented Oct 6, 2016

I'm sorry, I meant #1967. Indeed 1957 is completely unrelated.

@guotong1988
Copy link
Contributor

I want to work on this issue

@guotong1988
Copy link
Contributor

@girving
Copy link
Contributor

girving commented Apr 24, 2017

It may be too late for @guoguo12's assistance, but if anyone else wants to jump on this I'm happy to answer questions. The solution is to make a MaxPoolV2 C++ op similar to TopKV2, and do the same for all the other convolutional ops. We'd then deprecate the old op with .Deprecated and make the Python routines use the new version. Here's TopK and TopKV2 for comparison:

https://github.com/tensorflow/tensorflow/blob/master/tensorflow/core/ops/nn_ops.cc#L2013
https://github.com/tensorflow/tensorflow/blob/master/tensorflow/core/ops/nn_ops.cc#L2048

@guoguo12
Copy link
Contributor

(You mean @guotong1988.)

@girving
Copy link
Contributor

girving commented Apr 24, 2017

Whoops, sorry about that.

@yongtang
Copy link
Member

Created a PR #9514 to try to address this issue. Would appreciate any review or comments.

@colaskirschoff
Copy link

@ayushchd I guess it's a bit late but there is a work around if you need to do your max_pool on a unique dimension. In this case you do not need any kernel size nor strides so you can use reduce_max directly.

@nkszjx
Copy link

nkszjx commented Apr 8, 2019

pool = tf.reduce_max(activation, axis=1, keep_dims=True)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stat:contribution welcome Status - Contributions welcome
Projects
None yet
8 participants