Input 0 of layer “LSTM” is incompatible with the layer: expected ndim=3, found ndim=4. Full shape received: (None, None, None, 128)
Call arguments received by layer “sequential” (type Sequential):
• inputs=tf.Tensor(shape=(None, None, 1), dtype=float32)
• training=None
• mask=None
always post screenshot of complete error.
Solved error by passing shape=(1) to both in puts. Please let me know if any issues with that.
your error is resolved?
in your input1 and input2, instructions mentions one to identify input with shape as tuple and datatype.
when you mention the input shape as (None,1) you are probably creating the error you have encountered.
The instructions given were
tf.keras.layers.Input: it is used to instantiate a Keras tensor. Remember to set correctly the dimension and type of the input, which are batches of questions. For this, keep in mind that each question is a single string.
Input(input_shape,dtype=None,…)
input_shape: Shape tuple (not including the batch axis)
dtype: (optional) data type of the input
dtype=None was mentioned as general way as an input is mentioned but if you read the explanation part, which mentions each question is a single string and as here the input is tf.keras.Input, the string to be used should tf.string. Input shape as (1) for both input1 and input2. in the error if you notice input 2 shape you have mentioned it as (None, 1) which is incorrect as the number of dimension with None, 1, you increased the number of dimensions.
Based on your previous comment, I understand you already have debugged your code, but this explanation is for any future learners encountering similar error.
Regards
DP
1 Like
Correct! I fixed it as you explained above. Thanks for your help as always