Error: Input 0 of layer 'batch_normalization' is incompatible with the layer: expected ndim=2, found ndim=4.
Hola, yo no hablo espanhol mas:
it seems your model asks for 2 dimensions but your input tensor has a shape of 4 dimensions.  Maybe you could try to change the Input layers? It could be done by  adding a flattening layer as the first layer like this: 
model.add(keras.layers.Flatten(input_shape=(height,width,depth))) 
Otherwise it can help if you could share the code for your model. You can also use model.summary() to debug, it will show you the current shapes.


 @ApprikatAI,
Could you please provide the complete standalone code to reproduce the issue and also the tensorflow version you are using which helps us to analyse the issue in an effective way. 

Also the input shape provided is (32, 32, 3) but your model's input isn't taking that shape. You can try as follows for your model input.

```
model = keras.Sequential()

# Before 1st dense layer adding a Flatten layer that will flat the 
# coming tensor of shape (32, 32, 3).
model.add(keras.layers.Flatten(input_shape=(32, 32, 3)))
model.add(keras.layers.Dense(units=1000, activation=activation))

model.add(keras.layers.BatchNormalization())
```


Thank you! This issue is stale because it has been open for 7 days with no activity. It will be closed if no further activity occurs. Thank you. This issue is stale because it has been open for 7 days with no activity. It will be closed if no further activity occurs. Thank you. This issue was closed because it has been inactive for 7 days since being marked as stale. Please reopen if you'd like to work on this further. Are you satisfied with the resolution of your issue?
<a href="https://docs.google.com/forms/d/e/1FAIpQLSfaP12TRhd9xSxjXZjcZFNXPGk4kc1-qMdv3gc6bEP90vY1ew/viewform?entry.85265664=Yes&entry.2137816233=https://github.com/tensorflow/tensorflow/issues/60938">Yes</a>
<a href="https://docs.google.com/forms/d/e/1FAIpQLSfaP12TRhd9xSxjXZjcZFNXPGk4kc1-qMdv3gc6bEP90vY1ew/viewform?entry.85265664=No&entry.2137816233=https://github.com/tensorflow/tensorflow/issues/60938">No</a>

Estoy intentando entrenar un modelo GAN utilizando Keras en TensorFlow, pero estoy encontrando el siguiente error:

```
Input 0 of layer 'batch_normalization' is incompatible with the layer: expected ndim=2, found ndim=4. Full shape received: (None, None, None, 32768)
```

El error ocurre cuando intento entrenar el modelo con el siguiente código:

```python
history = model.fit(train_generator, epochs=100, callbacks=[checkpoint, tensorboard])
```

¿Alguien podría ayudarme a entender qué está causando este error y cómo puedo solucionarlo? Gracias.