title: dimension mismatch in args to gemm python
body: <p>I am using theano for the first time. I am using this <a href="http://deeplearning.net/tutorial/mlp.html#mlp" rel="nofollow noreferrer">tutorial</a> code, and I defined some shared variables, this way:</p>
  
  <pre><code>train_set_x_sh = theano.shared(np.asarray(train_set_x))
  train_set_y_sh = theano.shared(np.asarray(train_set_y))
  
  train_model = theano.function(
      inputs=[index],
      outputs=cost,
      updates=updates,
      givens={
          x: train_set_x_sh[index * batch_size: (index + 1) * batch_size],
          y: train_set_y_sh[index * batch_size: (index + 1) * batch_size]
      }
  )
  </code></pre>
  
  <p>However, when I want to use these shared variables I've got this error:</p>
  
  <pre><code>ValueError: dimension mismatch in args to gemm (20,52)x(784,500)-&gt;(20,500)
  Apply node that caused the error: GpuDot22(GpuSubtensor{int32:int32:}.0, W)
  Toposort index: 14
  Inputs types: [CudaNdarrayType(float32, matrix),CudaNdarrayType(float32, matrix)]
  Inputs shapes: [(20, 52), (784, 500)]
  Inputs strides: [(52, 1), (500, 1)]
  Inputs values: ['not shown', 'not shown']
  Outputs clients: [[GpuElemwise{Composite{tanh((i0 + i1))}}[(0, 0)](GpuDot22.0, GpuDimShuffle{x,0}.0)]]
  </code></pre>