title: Dimensions Mismatch in julia
body: <p>I'm getting this error:</p>
  
  <pre><code>DimensionMismatch("second dimension of A, 1, does not match length of x, 20")
  </code></pre>
  
  <p>for the following code. I'm trying to train a model on some sample <code>data</code>. I'm using the <code>Flux</code> machine learning library in Julia.</p>
  
  <p>I've checked my dimensions and they seem right to me. What is the problem?</p>
  
  <pre><code>using Flux
  using Flux: mse
  
  data = [(i,i) for i in 1:20]
  x = [i for i in 1:20]
  y = [i for i in 1:20]
  
  m = Chain(
   Dense(1, 10, relu),
   Dense(10, 1),
   softmax)
  
  opt = ADAM(params(m))
  
  loss(x, y) = mse(m(x), y)
  evalcb = () -&gt; @show(loss(x, y))
  accuracy(x, y) = mean(argmax(m(x)) .== argmax(y))
  
  #this line gives the error
  Flux.train!(loss, data, opt,cb = throttle(evalcb, 10))
  </code></pre>