ValueError: Input 0 of layer sequential_40 is incompatible with the layer
Solution 1:
Problem with Input shape. tf.keras.layers.TimeDistributed
expects batch size as input. Expects inputs: Input tensor of shape (batch, time, ...)
.
In the main_input add batch_size
main_input = Input(shape=(10, 200, 189, 1))
Working sample code
import tensorflow as tf
cnn = tf.keras.Sequential()
cnn.add(tf.keras.layers.Conv2D(64, 1, 1, input_shape=(200, 189, 1)))
cnn.add(tf.keras.layers.Flatten())
cnn.output_shape
main_input = tf.keras.Input(shape=(10, 200, 189, 1))
outputs = tf.keras.layers.TimeDistributed(cnn)(main_input)
outputs.shape
Output
TensorShape([None, 10, 2419200])