Exercise - 4 Transformer

Programming Assignment: Transformers Architecture with TensorFlow
I have been stuck in this one assignment for past 2 days… will anyone can help me to solve this ? or can mentors reset my cassignment

It appears the first problem is with your scaled_dot_product_attention() function. The error message tells you it has to do with how it uses the mask parameter.

Given that error, none of the other functions will work correctly.

The grader tests your code with different data than is used in the notebook.

# moderator edit: code removed

can you reset my lab to the initial version. I think i messed up it…

You can do that yourself. The first topic on the DLS FAQ Thread shows how. The mentors can’t do it for you in any case.

1 Like

Please don’t post your code on the forum. That isn’t allowed by the Code of Conduct.
I’ll edit your message to remove the code.


  • Try using the last dimension of ‘k’ to get the shape. Not always dimension 0.
  • Read the “Reminder” that’s part of the Exercise 3 instructions.
  • You haven’t specified an axis for the softmax activation to use.