I am having issues correctly shaping the 3-dimensional layer in the model. Each time I run the code, I receive the error ValueError: Input 0 of layer "SDropout_0" is incompatible with the layer: expected ndim=3, found ndim=4. Full shape received: (None, 1, 26, 64)

I have tried a few different things but it seems that I am missing something to make sure it is a 3-dim and not a 4-dim. Any advice would be greatly appreciated.


# Define the input shape and the number of output classes
input_shape = (1, 26)
output_classes = 10

# Define the model using the TCN architecture
model = keras.Sequential()
model.add(keras.layers.Reshape((input_shape[0], input_shape[1], 1, 64)))

#this line has been change many times: 
#model.add(keras.layers.Reshape(target_shape=(input_shape + (1,)), input_shape=input_shape))
#model.add(keras.layers.Reshape(input_shape + (1,), input_shape=input_shape))

model.add(TCN(64, return_sequences=True))
model.add(TCN(32, return_sequences=False))
model.add(keras.layers.Dense(output_classes, activation='linear'))

model.compile(optimizer=keras.optimizers.Adam(), loss='mean_squared_error')


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.