##
Hello I got this error for exercise 5, but could not find my mistake. Can anyone help me to solve the problem?

AssertionError Traceback (most recent call last)

in

28 print("\033[92mAll tests passed")

29

—> 30 Encoder_test(Encoder)

in Encoder_test(target)

24 [[-0.3489219, 0.31335592, -1.3568854, 1.3924513 ],

25 [-0.08761203, -0.1680029, -1.2742313, 1.5298463 ],

—> 26 [ 0.2627198, -1.6140151, 0.2212624 , 1.130033 ]]]), “Wrong values”

27

28 print("\033[92mAll tests passed")

AssertionError: Wrong values

##
Also for ex. 7 I got similar error, I think I do the same mistake in ex. 7.

tf.Tensor([nan nan nan nan], shape=(4,), dtype=float32)

AssertionError Traceback (most recent call last)

in

48 print("\033[92mAll tests passed")

49

—> 50 Decoder_test(Decoder)

in Decoder_test(target)

36 assert np.allclose(tf.shape(outd), tf.shape(encoderq_output)), f"Wrong shape. We expected { tf.shape(encoderq_output)}"

37 print(outd[1, 1])

—> 38 assert np.allclose(outd[1, 1], [-0.2715261, -0.5606001, -0.861783, 1.69390933]), “Wrong values in outd”

39

40 keys = list(att_weights.keys())

AssertionError: Wrong values in outd

Hey, I have just solved the problem.

Thank you.

Lilit

Hi Lilit, I’m also having the same challange.

any help would be appreciated.

Hi @sankarg

My mistake was in this formula:

x *= tf.sqrt(tf.cast(self.embedding_dim, tf.float32))

instead of self.embedding_dim I wrote x, but I corrected it and passed the test.

Hope this will help you.

1 Like