Keep getting this error Input 0 of layer “lstm_15” is incompatible with the layer: expected ndim=3, found ndim=4. Full shape received: (64, 14, 256, 256). Can someone help me figure it out?
Here is the entire log:
ValueError Traceback (most recent call last)
Cell In[24], line 7
4 decoder = Decoder(VOCAB_SIZE, UNITS)
6 # Notice that you don’t need the embedded version of sr_translation since this is done inside the class
----> 7 logits = decoder(encoder_output, sr_translation)
9 print(f’Tensor of contexts has shape: {encoder_output.shape}‘)
10 print(f’Tensor of right-shifted translations has shape: {sr_translation.shape}’)
File /usr/local/lib/python3.8/dist-packages/keras/src/utils/traceback_utils.py:70, in filter_traceback..error_handler(*args, **kwargs)
67 filtered_tb = _process_traceback_frames(e.traceback)
68 # To get the full stack trace, call:
69 # tf.debugging.disable_traceback_filtering()
—> 70 raise e.with_traceback(filtered_tb) from None
71 finally:
72 del filtered_tb
Cell In[23], line 66, in Decoder.call(self, context, target, state, return_state)
60 x = self.embedding(context)
62 # Pass the embedded input into the pre attention LSTM
63 # Hints:
64 # - The LSTM you defined earlier should return the output alongside the state (made up of two tensors)
65 # - Pass in the state to the LSTM (needed for inference)
—> 66 x, hidden_state, cell_state = self.pre_attention_rnn(x, initial_state=state)
68 # Perform cross attention between the context and the output of the LSTM (in that order)
69 x = self.attention(context, target)
ValueError: Exception encountered when calling layer ‘decoder_2’ (type Decoder).
Input 0 of layer “lstm_15” is incompatible with the layer: expected ndim=3, found ndim=4. Full shape received: (64, 14, 256, 256)
Call arguments received by layer ‘decoder_2’ (type Decoder):
• context=tf.Tensor(shape=(64, 14, 256), dtype=float32)
• target=tf.Tensor(shape=(64, 15), dtype=int64)
• state=None
• return_state=False