Shape inconsistency for strided pooling with ignore_border=False #4534

Closed
f0k opened this Issue May 18, 2016 · 2 comments

Comments

Projects
None yet
2 participants
@f0k
Contributor

f0k commented May 18, 2016

As reported in Lasagne/Lasagne#685, there's something wrong with Theano's pooling implementation for ignore_border=False. Reduced test case:

>>> import numpy as np
>>> import theano
>>> import theano.tensor as T
>>> x = np.ones((1,1,4,4), dtype=theano.config.floatX)
>>> y = T.signal.pool.pool_2d(T.constant(x), (4,4), ignore_border=False, st=(2,2))
>>> y.shape.eval()
(1, 1, 1, 1)
>>> y.eval().shape
(1, 1, 2, 2)

So we pool a 4x4 image with a 4x4 window with stride 2. The result should be 1x1, regardless of whether we ignore the border or not.
The evaluated shape (y.shape.eval()) is correct, but the shape of the evaluated value (y.eval().shape) is too large.

@nouiz

This comment has been minimized.

Show comment
Hide comment
@nouiz

nouiz May 18, 2016

Member

I have a fix, I still need to finish it and add tests.

On Wed, May 18, 2016 at 10:50 AM, Jan Schlüter notifications@github.com
wrote:

As reported in Lasagne/Lasagne#685
Lasagne/Lasagne#685, there's something wrong
with Theano's pooling implementation for ignore_border=False. Reduced
test case:

import numpy as np
import theano
import theano.tensor as T
x = np.ones((1,1,4,4), dtype=theano.config.floatX)
y = T.signal.pool.pool_2d(T.constant(x), (4,4), ignore_border=False, st=(2,2))
y.shape.eval()
(1, 1, 1, 1)
y.eval().shape
(1, 1, 2, 2)

So we pool a 4x4 image with a 4x4 window with stride 2. The expected
result should be 1x1, regardless of whether we ignore the border or not.
The evaluated shape (y.shape.eval()) is correct, but the shape of the
evaluated value (y.eval().shape) is too large.


You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub
#4534

Member

nouiz commented May 18, 2016

I have a fix, I still need to finish it and add tests.

On Wed, May 18, 2016 at 10:50 AM, Jan Schlüter notifications@github.com
wrote:

As reported in Lasagne/Lasagne#685
Lasagne/Lasagne#685, there's something wrong
with Theano's pooling implementation for ignore_border=False. Reduced
test case:

import numpy as np
import theano
import theano.tensor as T
x = np.ones((1,1,4,4), dtype=theano.config.floatX)
y = T.signal.pool.pool_2d(T.constant(x), (4,4), ignore_border=False, st=(2,2))
y.shape.eval()
(1, 1, 1, 1)
y.eval().shape
(1, 1, 2, 2)

So we pool a 4x4 image with a 4x4 window with stride 2. The expected
result should be 1x1, regardless of whether we ignore the border or not.
The evaluated shape (y.shape.eval()) is correct, but the shape of the
evaluated value (y.eval().shape) is too large.


You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub
#4534

nouiz added a commit to nouiz/Theano that referenced this issue May 20, 2016

@nouiz nouiz referenced this issue May 20, 2016

Merged

Pool shape #4544

@nouiz

This comment has been minimized.

Show comment
Hide comment
@nouiz

nouiz May 20, 2016

Member

thanks the problem seem to be only when the window is bigger then the image. I have a PR:

#4544

Member

nouiz commented May 20, 2016

thanks the problem seem to be only when the window is bigger then the image. I have a PR:

#4544

@abergeron abergeron closed this in #4544 May 26, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment