I'm trying to learn how the convolution layer works in neural networks. I found two different related posts for a similar issue and tried the suggestions, but could not get around.
- Keras dimensionality in convolutional layer mismatch
- ValueError: Input 0 is incompatible with layer conv_1: expected ndim=3, found ndim=4
import tensorflow as tf
model_valid = tf.keras.Sequential([
tf.keras.layers.Flatten(input_shape=(10,)),
tf.keras.layers.Dense(16, activation='relu'),
tf.keras.layers.Conv1D(16, kernel_size=(2), activation='relu', padding='same'),
tf.keras.layers.MaxPooling1D(pool_size=(4), strides=3, padding='valid'),
tf.keras.layers.Flatten(),
tf.keras.layers.Dense(1, activation='softmax')
])
model_valid.summary()
I am receiving an incompatiblity issue as Input 0 of layer conv1d_37 is incompatible with the layer: expected ndim=3, found ndim=2. Full shape received: [None, 16]
. The issue arises when building up the convolution layer.