Natural Language Processing with Attention Models C4W2_Assignment All tests pass but all scores are 0

I’m getting a problem that others have gotten before - namely that all tests passed / I get expected output (up until the very last one), but the grading is all 0.

I get the grader output like:

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)

I’ve seen several links to this thread, but can’t apply the findings here to get a score on my assignment.

There it says: " For future learners - the OP’s mistake was in defining the dec_padding_mask."

However, I don’t see an obvious problem with how I have defined this in my code. I’m also a bit confused how an error here could cause my “scaled_dot_product_attention” exercise to have a score 0 (although I don’t know how the grading works :P)

Thanks in advance for any hints!

I’m not a mentor for this course, so I don’t have a direct answer.

The error message suggests you have a shape mismatch when using the grader’s test cases.

Verify that your code will work with any size or shape of data. The grader’s test cases are entirely different than those used in the notebook.

For example, check if you’re using any global variables or fixed value constants in places where it isn’t appropriate. This is a common mistake.

2 Likes

@Pf_lute0901

The thread you have referred is pointing you to use the assignment argument recall mask for the grade cell you are encountering this error.

If you are unable to the hints, kindly DM me your codes for the particular grade cell you are getting this error. Only share a screenshot, click on my name and then message.

Regards
DP

1 Like

Thanks for the responses. For reference for future readers: After looking back through my code, I found that the hint in the first exercise “(check how you can use the parameter transpose_b).” was very important → I tried calculating the transpose in a different way, which did not work. After fixing this, I got full points on each exercise. Thanks :slight_smile:

2 Likes