title: ValueError: Shapes (None, 9) and (None, 10) are incompatible
body: <p>I have a dataset with 565 features and 10 different columns on the prediction site for predicting labels in the training model.Here is the model summary dimensions :</p>
  <pre><code>_________________________________________________________________
  Model: &quot;sequential&quot;
  _________________________________________________________________
  Layer (type)                 Output Shape              Param #
  =================================================================
  conv1d (Conv1D)              (None, 564, 64)           256
  _________________________________________________________________
  flatten (Flatten)            (None, 36096)             0
  _________________________________________________________________
  dense (Dense)                (None, 50)                1804850
  _________________________________________________________________
  dense_1 (Dense)              (None, 50)                2550
  _________________________________________________________________
  dense_2 (Dense)              (None, 50)                2550
  _________________________________________________________________
  dense_3 (Dense)              (None, 50)                2550
  _________________________________________________________________
  dense_4 (Dense)              (None, 10)                510
  =================================================================
  Total params: 1,813,266
  Trainable params: 1,813,266
  Non-trainable params: 0
  _________________________________________________________________
  </code></pre>
  <p>Here is the code I have used :</p>
  <pre><code>import pandas as pd
  import numpy as np
  from tensorflow.keras.models import Sequential
  from tensorflow.keras.layers import Dense, Conv1D, Flatten
  from tensorflow.keras import optimizers
  from sklearn.metrics import confusion_matrix
  import tensorflow as tf
  import tensorflow.keras.metrics
  
      data = pd.read_csv('Step1_reducedfile.csv',skiprows = 1,header = None)
      data = data.sample(frac=1).reset_index(drop=True)
      train_X = data[0:data.shape[0],0:566]
      train_y = data[0:data.shape[0],566:data.shape[1]]
      train_X = train_X.reshape((train_X.shape[0], train_X.shape[1], 1))
      
      import random
      
      neurons = 50
      
              
      strategy = tensorflow.distribute.MirroredStrategy()             
      with strategy.scope():
          model = tf.keras.Sequential([
            tf.keras.layers.Conv1D(64,kernel_size = 3,activation='relu',input_shape=train_X.shape[1:]),
            tf.keras.layers.Flatten(),
            tf.keras.layers.Dense(neurons,activation='relu'),
            tf.keras.layers.Dense(neurons,activation='relu'),
            tf.keras.layers.Dense(neurons,activation='relu'),
            tf.keras.layers.Dense(neurons,activation='relu'),
            tf.keras.layers.Dense(10, activation='softmax'),])
          model.summary()
          sgd = optimizers.SGD(lr=0.05, decay=1e-6, momentum=0.24, nesterov=True)
          model.compile(loss='categorical_crossentropy',optimizer=sgd,metrics=['accuracy',tensorflow.keras.metrics.Precision()])
          model.summary()
          results = model.fit(train_X,train_y,validation_split = 0.2,epochs=10,batch_size = 100)
          print(results)
  </code></pre>
  <p>I am getting the following error :</p>
  <p>ValueError: in user code:</p>
  <pre><code>/usr/local/lib64/python3.6/site-packages/tensorflow/python/keras/engine/training.py:806 train_function  *
      return step_function(self, iterator)
  /usr/local/lib64/python3.6/site-packages/tensorflow/python/keras/engine/training.py:796 step_function  **
      outputs = model.distribute_strategy.run(run_step, args=(data,))
  /usr/local/lib64/python3.6/site-packages/tensorflow/python/distribute/distribute_lib.py:1211 run
      return self._extended.call_for_each_replica(fn, args=args, kwargs=kwargs)
  /usr/local/lib64/python3.6/site-packages/tensorflow/python/distribute/distribute_lib.py:2585 call_for_each_replica
      return self._call_for_each_replica(fn, args, kwargs)
  /usr/local/lib64/python3.6/site-packages/tensorflow/python/distribute/mirrored_strategy.py:585 _call_for_each_replica
      self._container_strategy(), fn, args, kwargs)
  /usr/local/lib64/python3.6/site-packages/tensorflow/python/distribute/mirrored_run.py:96 call_for_each_replica
      return _call_for_each_replica(strategy, fn, args, kwargs)
  /usr/local/lib64/python3.6/site-packages/tensorflow/python/distribute/mirrored_run.py:237 _call_for_each_replica
      coord.join(threads)
  /usr/local/lib64/python3.6/site-packages/tensorflow/python/training/coordinator.py:389 join
      six.reraise(*self._exc_info_to_raise)
  /usr/local/lib/python3.6/site-packages/six.py:703 reraise
      raise value
  /usr/local/lib64/python3.6/site-packages/tensorflow/python/training/coordinator.py:297 stop_on_exception
      yield
  /usr/local/lib64/python3.6/site-packages/tensorflow/python/distribute/mirrored_run.py:323 run
      self.main_result = self.main_fn(*self.main_args, **self.main_kwargs)
  /usr/local/lib64/python3.6/site-packages/tensorflow/python/keras/engine/training.py:789 run_step  **
      outputs = model.train_step(data)
  /usr/local/lib64/python3.6/site-packages/tensorflow/python/keras/engine/training.py:749 train_step
      y, y_pred, sample_weight, regularization_losses=self.losses)
  /usr/local/lib64/python3.6/site-packages/tensorflow/python/keras/engine/compile_utils.py:204 __call__
      loss_value = loss_obj(y_t, y_p, sample_weight=sw)
  /usr/local/lib64/python3.6/site-packages/tensorflow/python/keras/losses.py:149 __call__
      losses = ag_call(y_true, y_pred)
  /usr/local/lib64/python3.6/site-packages/tensorflow/python/keras/losses.py:253 call  **
      return ag_fn(y_true, y_pred, **self._fn_kwargs)
  /usr/local/lib64/python3.6/site-packages/tensorflow/python/util/dispatch.py:201 wrapper
      return target(*args, **kwargs)
  /usr/local/lib64/python3.6/site-packages/tensorflow/python/keras/losses.py:1535 categorical_crossentropy
      return K.categorical_crossentropy(y_true, y_pred, from_logits=from_logits)
  /usr/local/lib64/python3.6/site-packages/tensorflow/python/util/dispatch.py:201 wrapper
      return target(*args, **kwargs)
  /usr/local/lib64/python3.6/site-packages/tensorflow/python/keras/backend.py:4687 categorical_crossentropy
      target.shape.assert_is_compatible_with(output.shape)
  /usr/local/lib64/python3.6/site-packages/tensorflow/python/framework/tensor_shape.py:1134 assert_is_compatible_with
      raise ValueError(&quot;Shapes %s and %s are incompatible&quot; % (self, other))
  
  ValueError: Shapes (None, 9) and (None, 10) are incompatible
  </code></pre>