title: Error: "DimensionMismatch("matrix A has dimensions (1024,10), vector B has length 9")" using Flux in Julia
body: <p>i'm still new in Julia and in machine learning in general, but I'm quite eager to learn. In the current project i'm working on I have a problem about dimensions mismatch, and can't figure what to do.</p>
  
  <p>I have two arrays as follow:</p>
  
  <pre><code>x_array: 
  9-element Array{Array{Int64,N} where N,1}:
   [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 72, 73]
   [11, 12, 13, 14, 15, 16, 17, 72, 73]
   [18, 12, 19, 20, 21, 22, 72, 74]
   [23, 24, 12, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 72, 74]
   [36, 37, 38, 39, 40, 38, 41, 42, 72, 73]
   [43, 44, 45, 46, 47, 48, 72, 74]
   [49, 50, 51, 52, 14, 53, 72, 74]
   [54, 55, 41, 56, 57, 58, 59, 60, 61, 62, 63, 62, 64, 72, 74]
   [65, 66, 67, 68, 32, 69, 70, 71, 72, 74]
  
  
  y_array:
  9-element Array{Int64,1}
   75
   76
   77
   78
   79
   80
   81
   82
   83
  </code></pre>
  
  <p>and the next model using Flux:</p>
  
  <pre><code>model = Chain(
      LSTM(10, 256),
      LSTM(256, 128),
      LSTM(128, 128),
      Dense(128, 9),
      softmax
  )
  </code></pre>
  
  <p>I zip both arrays, and then feed them into the model using Flux.train!</p>
  
  <pre><code>data = zip(x_array, y_array)
  Flux.train!(loss, Flux.params(model), data, opt)
  </code></pre>
  
  <p>and immediately throws the next error: </p>
  
  <pre><code>ERROR: DimensionMismatch("matrix A has dimensions (1024,10), vector B has length 9")
  </code></pre>
  
  <p>Now, I know that the first dimension of matrix A is the sum of the hidden layers (256 + 256 + 128 + 128 + 128 + 128) and the second dimension is the input layer, which is 10. The first thing I did was change the 10 for a 9, but then it only throws the error:</p>
  
  <pre><code>ERROR: DimensionMismatch("dimensions must match")
  </code></pre>
  
  <p>Can someone explain to me what dimensions are the ones that mismatch, and how to make them match?</p>