Home Ask Login Register

Developers Planet

Your answer is one click away!

malioboro February 2016

Value Error: Dimension Mismatch .., in Theano

I just followed convolutional neural network tutorial and try to re-write the code from: http://deeplearning.net/tutorial/code/convolutional_mlp.py

and I try to change the code from line 108, from:

self.output = T.tanh(pooled_out + self.b.dimshuffle('x', 0, 'x', 'x'))


self.output = T.tanh(conv_out + self.b.dimshuffle('x', 0, 'x', 'x'))

and then I got this error:

ValueError: dimension mismatch in args to gemm (500,20000)x(800,500)->(500,500)
Apply node that caused the error: GpuDot22(GpuElemwise{tanh,no_inplace}.0, W)
Toposort index: 40
Inputs types: [CudaNdarrayType(float32, matrix), CudaNdarrayType(float32, matrix)]
Inputs shapes: [(500, 20000), (800, 500)]
Inputs strides: [(20000, 1), (500, 1)]
Inputs values: ['not shown', 'not shown']
Outputs clients: [[GpuElemwise{Composite{tanh((i0 + i1))}}[(0, 0)](GpuDot22.0, GpuDimShuffle{x,0}.0)]]

I don't know why is this happen, because I think pooled_out and conv_out have the same shape in the second dimension

can someone help me to explain why is this happen?


Daniel Renshaw February 2016

The problem is not inside the LeNetConvPoolLayer it's in the following layer which is expecting the output from the LeNetConvPoolLayer to be one size but is getting something else.

To skip the pooling, you'll need to adjust every layer that follows a LeNetConvPoolLayer to expect its input to be the appropriately larger size.

Post Status

Asked in February 2016
Viewed 1,527 times
Voted 8
Answered 1 times


Leave an answer

Quote of the day: live life