Hi! Is there anyone who can help me? I’m having a grading error.
I passed all the test but my grade is 0.
It said that:
There was a problem compiling the code from your notebook. Details:
Exception encountered when calling layer ‘softmax_3’ (type Softmax).
{{function_node _wrapped__AddV2_device/job:localhost/replica:0/task:0/device:CPU:0}} Incompatible shapes: [1,2,2,150] vs. [1,1,1,2] [Op:AddV2] name:
Call arguments received by layer ‘softmax_3’ (type Softmax):
• inputs=tf.Tensor(shape=(1, 2, 2, 150), dtype=float32)
• mask=tf.Tensor(shape=(1, 1, 1, 2), dtype=float32)
This error indicates that the shape of the mask is not the same as shape of the inputs (in the scaled_dot_product_attention case the inputs are scaled_attention_logits).
So the most probable place to look for a mistake is below the code comment: # add the mask to the scaled tensor. Here you would calculate the masked “inputs” for the softmax. (The hint suggests:
Reminder: The boolean mask parameter can be passed in as none or as either padding or look-ahead.
Multiply (1. - mask) by -1e9 before adding it to the scaled attention logits.
)
The other probable mistake could be how the softmax is calculated (TensorFlow intricacies…). Are you using: tf.keras.activations.softmax(..) for the attention_weights computation?
I’m having the same trouble on my notebook. I pass all the unit tests and used tf.keras.activations.softmax() for implementing the softmax, but get the following error when trying to use the summarize function. Did @Sadiah_Safirah find a resolution to this error? Thanks!