title: Runnnig a model.fit for cnn : valueError
body: <p>Once I want to train my model, I get the following error in the <code>model.fit()</code> line:</p>
  <p>Code:</p>
  <pre><code>DO = Denoiser()
  visible = Input(shape=(500, batch_size))
  my_denoiser = DO.rkhs(visible, kern, I_mat)
  conv1 = Conv1D(6, kernel_size=4, activation='relu')(visible)
  pool1 = MaxPooling1D(pool_size=5)(conv1)
  conv2 = Conv1D(12, kernel_size=4, activation='relu')(pool1)
  pool2 = MaxPooling1D(pool_size=5)(conv2)
  flat = Flatten()(pool2)
  hidden1 = Dense(10, activation='relu')(flat)
  output = Dense(3, activation='softmax')(hidden1)
  model = Model(inputs=visible, outputs=output)
  
  model.compile(optimizer='Adam', loss='categorical_crossentropy', metrics=['accuracy'])
  model.fit(new_signal, y, epochs=2, batch_size=200)
  </code></pre>
  <p>output :</p>
  <pre><code>   Model: &quot;model_3&quot;
  _________________________________________________________________
   Layer (type)                Output Shape              Param #   
  =================================================================
   input_6 (InputLayer)        [(None, 500, 128)]        0         
                                                                   
   conv1d_7 (Conv1D)           (None, 497, 6)            3078      
                                                                   
   max_pooling1d_7 (MaxPooling  (None, 99, 6)            0         
   1D)                                                             
                                                                   
   conv1d_8 (Conv1D)           (None, 96, 12)            300       
                                                                   
   max_pooling1d_8 (MaxPooling  (None, 19, 12)           0         
   1D)                                                             
                                                                   
   flatten_3 (Flatten)         (None, 228)               0         
                                                                   
   dense_6 (Dense)             (None, 10)                2290      
                                                                   
   dense_7 (Dense)             (None, 3)                 33        
                                                                   
  =================================================================
  Total params: 5,701
  Trainable params: 5,701
  Non-trainable params: 0
  _________________________________________________________________
  </code></pre>
  <p>Error:</p>
  <pre><code>ValueError: in user code:
  
  File &quot;/usr/local/lib/python3.7/dist-packages/keras/engine/training.py&quot;, line 1021, in train_function  *
      return step_function(self, iterator)
  File &quot;/usr/local/lib/python3.7/dist-packages/keras/engine/training.py&quot;, line 1010, in step_function  **
      outputs = model.distribute_strategy.run(run_step, args=(data,))
  File &quot;/usr/local/lib/python3.7/dist-packages/keras/engine/training.py&quot;, line 1000, in run_step  **
      outputs = model.train_step(data)
  File &quot;/usr/local/lib/python3.7/dist-packages/keras/engine/training.py&quot;, line 859, in train_step
      y_pred = self(x, training=True)
  File &quot;/usr/local/lib/python3.7/dist-packages/keras/utils/traceback_utils.py&quot;, line 67, in error_handler
      raise e.with_traceback(filtered_tb) from None
  File &quot;/usr/local/lib/python3.7/dist-packages/keras/engine/input_spec.py&quot;, line 264, in assert_input_compatibility
      raise ValueError(f'Input {input_index} of layer &quot;{layer_name}&quot; is '
  
  ValueError: Input 0 of layer &quot;model_3&quot; is incompatible with the layer: expected shape=(None, 500, 128), found shape=(None, 10)
  </code></pre>