Problem with Encoder in Transformer

Hello!

I am working in the Transformer_Lab of Course 5: Sequence Models of DLS at Coursera.

In exercise 5: Encoder at the end step # Pass the output through the stack of encoding layers

I have called the self.enc_layers and used the label [i] before the argments, and in the arguments I have used ( input, mask = mask and training = training).

I am having this error, please some help!

---------------------------------------------------------------------------
AssertionError                            Traceback (most recent call last)
<ipython-input-45-68aa9b8f5815> in <module>
      1 # UNIT TEST
----> 2 Encoder_test(Encoder)

~/work/W4A1/public_tests.py in Encoder_test(target)
    124                         [[-0.4612937 ,  1.0697356 , -1.4127715 ,  0.8043293 ],
    125                          [ 0.27027237,  0.28793618, -1.6370889 ,  1.0788803 ],
--> 126                          [ 1.2370994 , -1.0687275 , -0.8945037 ,  0.7261319 ]]]), "Wrong values case 1"
    127 
    128     encoderq_output = encoderq(x, True, np.array([[[[1., 1., 1.]]], [[[1., 1., 0.]]]]))

AssertionError: Wrong values case 1


Nope. Try x and training and mask. Also try leaving off the ='s.

Thanks for your answer. I have considered your suggestions and I have the same error.

---------------------------------------------------------------------------
AssertionError                            Traceback (most recent call last)
<ipython-input-29-68aa9b8f5815> in <module>
      1 # UNIT TEST
----> 2 Encoder_test(Encoder)

~/work/W4A1/public_tests.py in Encoder_test(target)
    124                         [[-0.4612937 ,  1.0697356 , -1.4127715 ,  0.8043293 ],
    125                          [ 0.27027237,  0.28793618, -1.6370889 ,  1.0788803 ],
--> 126                          [ 1.2370994 , -1.0687275 , -0.8945037 ,  0.7261319 ]]]), "Wrong values case 1"
    127 
    128     encoderq_output = encoderq(x, True, np.array([[[[1., 1., 1.]]], [[[1., 1., 0.]]]]))

AssertionError: Wrong values case 1


oh! I found the problem. This is because I don´t know python enough. I was multiplying twice the part of the sqrt of self embedding. Anyway, thanks again for your attention.

2 Likes