title: GlobalAvgPool1D incompatible with output size
body: <p>My input shape is (150,10,1) and my output has the same shape (150,10,1). My problem is multi-classification (3 classes). After using np_utils.to_categorical(Ytrain) the output shape will be (150,10,3) which is perfect. However during the process of modelling with GlobalAvgPool1D(), it gives the error :
  "A target array with shape (150, 10, 3) was passed for an output of shape (None, 3) while using as loss <code>categorical_crossentropy</code>. This loss expects targets to have the same shape as the output". 
  How should I fix it? </p>
  
  <p>My codes: </p>
  
  <pre><code>nput_size = (150, 10, 1)
  Xtrain = np.random.randint(0, 100, size=(150, 10, 1))
  
  Ytrain = np.random.choice([0,1, 2], size=(150, 10,1))
  Ytrain = np_utils.to_categorical(Ytrain)
  
  input_shape = (10, 1)
  input_layer = tf.keras.layers.Input(input_shape)
  conv_x = tf.keras.layers.Conv1D(filters=32, kernel_size=10, strides = 1, padding='same')(input_layer)
  
  conv_x = tf.keras.layers.BatchNormalization()(conv_x)
  conv_x = tf.keras.layers.Activation('relu')(conv_x)
  g_pool = tf.keras.layers.GlobalAvgPool1D()(conv_x)
  output_layer = tf.keras.layers.Dense(3, activation='softmax')(g_pool)
  model = tf.keras.models.Model(inputs= input_layer, outputs = output_layer) 
  model.summary()
  
  model.compile(loss='categorical_crossentropy', optimizer= tf.keras.optimizers.Adam(), 
            metrics='accuracy'])
  hist = model.fit(Xtrain, Ytrain, batch_size= 5, epochs= 10, verbose= 0)
  </code></pre>