I'd recommend compiling a function to see what the actual shape of h1p is, that will help you understand if the problem is on your end or with theano. In this specific case I think the issue is that you've specified st=(1,1) for the pooling, so you aren't actually doing a traditional 2x2 maxpool. You need to either set st=(2,2), or leave it undefined in which case it defaults to whatever ds is set to.
On Sunday, July 24, 2016 at 7:28:21 PM UTC-4, [email protected] wrote: > > Hello dear community members. > I am facing this weird behavior of > conv2d() > function in a convent. > > I'll try to explain the situation with a simple example of a convent with > only two convolutions. > Imagine that I have the following filters and their corresponding size > w1 = (32, 1, 1, 1) > w2 = (64, 32, 3, 3) > > Then my convent would be something like the following: > h1 = conv2d(X, w1, image_shape=(64, 1, 28, 28), filter_shape=w1.shape) > h1p = pool_2d(h1, ds=(2,2), st=(1,1), ignore_border=True) > h2 = conv2d(h1p, w2, image_shape=(64, 32, 14, 14), filter_shape=w2.shape) > h2p = pool_2d(h2, ds(2,2), st=(1,1), ignore_border=True) > > In this case I get an error complaining about the image shape as an input > regarding the second convolution. It says that should be 27 instead of 14. > This where things start to get a bit unclear for me. By looking at the > conv2d() documentation its says that if you use the valid mode which is the > default > in this case then the output image_shape from the convolution is computed > as image_shape - filter_shape + 1. > If we consider that then from our first image_shape=(64, 1, 28, 28) as > input to the first convolution operation we would have the following > image_shape dimension: > image_height = 28 - 1 (filter_height) + 1 (Constant) > new_image_height = 28 (unchanged from the above computations) > > now if we do a downsampling with filter size = (2,2) > > final_new_image_height = 28/2 = 14 > > As I have exactly putted in my second convolution. Now why is theano > complaining about that and is asking that the input should be 27 instead > for the image height and width. It seems like the pooling is either being > skipped or never considered by theano in this case. Why is that happening? > > Any developers of theano who can shed some light on this topic? > > Thanks! > > > -- --- You received this message because you are subscribed to the Google Groups "theano-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
