Check compute_test_value. It is there to help find where in your code you have this type of problem:
http://deeplearning.net/software/theano/library/config.html?highlight=test%20value#config.compute_test_value On Wed, Nov 2, 2016 at 5:34 PM, Sidhika Varshney <[email protected] > wrote: > Hi Mangalam > > I am facing similar issue as you faced of shape mismatch when using my own > data and changing the dimensions according to my data set. Could you > please help me if you found the solution for this > > > On Monday, 23 March 2015 20:00:15 UTC-4, Mangalam Sankupellay wrote: >> >> Thanks Pascal. Will make the suggested changes & see how it goes. >> >> On Tuesday, 24 March 2015 06:00:42 UTC+10, Pascal Lamblin wrote: >>> >>> On Sun, Mar 22, 2015, Mangalam Sankupellay wrote: >>> > I'm getting the following error when I run it with my own data >>> > (file.pkl.gz). However, there's no error when I run mlp.py with my own >>> > data. I'm unsure what are my mistakes. >>> >>> Here is the important part of the error message: >>> >>> > ValueError: the number of rows in the image (284) at run time is >>> different >>> > than at build time (12) for the ConvOp. >>> >>> It means that you have an input shape of 284 on some dimension, but the >>> convolution expect it to be 12. From your code, it seems it happens on >>> layer1: >>> >>> > # Construct the second convolutional pooling layer >>> > # filtering reduces the image size to (12-5+1, 12-5+1) = (8, 8) >>> > # maxpooling reduces this further to (8/2, 8/2) = (4, 4) >>> > # 4D output tensor is thus of shape (batch_size, nkerns[1], 4, 4) >>> > layer1 = LeNetConvPoolLayer( >>> > rng, >>> > input=layer0.output, >>> > image_shape=(batch_size, nkerns[0], 12, 12), >>> > filter_shape=(nkerns[1], nkerns[0], 5, 5), >>> > poolsize=(2, 2) >>> > ) >>> >>> You have different options options: >>> - not specify the input shape of the convolution of layer1 at all >>> (pass None, or do not mention it) >>> - specify only the shapes you are sure about, for instance (batch_size, >>> nkerns[0], None, None) >>> - pass the appropriate shapes. >>> >>> You will also have to fix the input shape of the fully-connected layer: >>> >>> > # the HiddenLayer being fully-connected, it operates on 2D >>> matrices of >>> > # shape (batch_size, num_pixels) (i.e matrix of rasterized >>> images). >>> > # This will generate a matrix of shape (batch_size, nkerns[1] * 4 >>> * 4), >>> > # or (500, 50 * 4 * 4) = (500, 800) with the default values. >>> > layer2_input = layer1.output.flatten(2) >>> > >>> > # construct a fully-connected sigmoidal layer >>> > layer2 = HiddenLayer( >>> > rng, >>> > input=layer2_input, >>> > n_in=nkerns[1] * 4 * 4, >>> > n_out=4, >>> > activation=T.tanh >>> > ) >>> >>> Hope this helps, >>> -- >>> Pascal >>> >> -- > > --- > 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. > -- --- 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.
