C5 W4: Exercise 4 EncoderLayer() At least need to know

I have investigated to solve this issue. I only could able to solve this problem with the help of official documents of the TensorFlow call() method:

Look at those required positional arguments query, key, value, and attention_mask and passed into self.mha(…).

I am easy to find the deal with the problem by look the diagram and figure it out how to input pass to the next layer
image

Sorry, but I don’t quite understand if you are asking a question, and what exactly you need help with.

Oh sorry, it was a general post for helping folks tackle that exercise. Did I post the wrong place?

That’s fine, I just wasn’t sure if you were asking a question.

how do we extract q,v,k and pass it in self.mha()

For self-attention, you use ‘x’ for all three of them.

That’s why there is one line coming up into the MHA box in Fig 2a, then it splits into three separate inputs. They’re all the same data.

I’ve submitted a support ticket to have the arrows in that figure labeled.

1 Like

i thought so too, so i tried that in the first place, i got this error


any suggestions on what might be wrong.
Thanks

Please post another image that shows the entire assert stack. The interesting errors tend to be in the top or middle, not the bottom.


i underlined the code where i got error

Look at the function definition for self.mha(). It requires four arguments. You only provided two.

now also …:frowning:

You don’t have the correct arguments for self.mha().
I replied earlier to use ‘x’ for all three of K, Q, and V.
That means you put ‘x’ in the call arguments three times.

Hi TMosh,
Thank you for the support, i really appretiate it. i completed the assignment.

Thanks for letting me be part of this course