title: Concatenation of Keras parallel layers changes wanted target shape
body: <p>I'm a bit new to Keras and deep learning. I'm currently trying to replicate this <a href="https://pdfs.semanticscholar.org/4afe/f0c6039a5d8b647518b6fe05f47a8bd3aeee.pdf" rel="nofollow noreferrer">paper</a> but when I'm compiling the first model (without the LSTMs) I get the following error:</p>
  
  <blockquote>
    <p>"ValueError: Error when checking target: expected dense_3 to have shape (None, 120, 40) but got array with shape (8, 40, 1)"</p>
  </blockquote>
  
  <p>The description of the model is this:</p>
  
  <ol>
  <li>Input (length <code>T</code> is appliance specific window size)</li>
  <li>Parallel 1D convolution with filter <code>size</code> 3, 5, and 7
  respectively, <code>stride=1</code>, <code>number of filters=32</code>,
  <code>activation type=linear</code>, <code>border mode=same</code></li>
  <li>Merge layer which concatenates the output of
  parallel 1D convolutions</li>
  <li>Dense layer, <code>output_dim=128</code>, <code>activation type=ReLU</code></li>
  <li>Dense layer, <code>output_dim=128</code>, <code>activation type=ReLU</code></li>
  <li>Dense layer, <code>output_dim=T</code> , <code>activation type=linear</code></li>
  </ol>
  
  <p>My code is this:</p>
  
  <pre><code>from keras import layers, Input
  from keras.models import Model
  
  # the window sizes (seq_length?) are 40, 1075, 465, 72 and 1246 for the kettle, dish washer,
  # fridge, microwave, oven and washing machine, respectively.
  
  def ae_net(T):
      input_layer = Input(shape= (T,))
      branch_a = layers.Conv1D(32, 3, activation= 'linear', padding='same', strides=1)(input_layer)
      branch_b = layers.Conv1D(32, 5, activation= 'linear', padding='same', strides=1)(input_layer)
      branch_c = layers.Conv1D(32, 7, activation= 'linear', padding='same', strides=1)(input_layer)
  
      merge_layer = layers.concatenate([branch_a, branch_b, branch_c], axis=1)
  
      dense_1 = layers.Dense(128, activation='relu')(merge_layer)
      dense_2 =layers.Dense(128, activation='relu')(dense_1)
      output_dense = layers.Dense(T, activation='linear')(dense_2)
      model = Model(input_layer, output_dense)
      return model
  
  model = ae_net(40)
  model.compile(loss= 'mean_absolute_error', optimizer='rmsprop')
  model.fit(X, y, batch_size= 8)
  </code></pre>
  
  <p>where <code>X</code> and <code>y</code> are <code>numpy arrays</code> of 8 sequences of a length of 40 values. So <code>X.shape</code> and <code>y.shape</code> are <code>(8, 40, 1)</code>. It's actually one batch of data. The thing is I cannot understand how the output would be of shape <code>(None, 120, 40)</code> and what these sizes would mean.</p>