Test crash when jointly testing translator, endcoder, decoder

Hello there,
My lab code faxeybesccbp
when running this line
w1_unittest.test_translator(Translator, Encoder, Decoder)
InvalidArgumentError: Exception encountered when calling layer ‘key’ (type EinsumDense).

{{function_node _wrapped__Einsum_N_2_device/job:localhost/replica:0/task:0/device:GPU:0}} Expected dimension 8 at axis 0 of the input shaped [256,1,256] but got dimension 256 [Op:Einsum] name:

Call arguments received by layer ‘key’ (type EinsumDense):
• inputs=tf.Tensor(shape=(4, 7, 8), dtype=float32)
it happens with attempt to run MHA.

all previous tests are passing including translator, encoder, decoder test.
Thank you

hi @Fares_Bagh

There is a code error as your dimensions don’t match. This could happen if there is a mismatch between the way you used recall functions for encoder and decoder, and the same how you applied in the translator especially related to a layer recall function.

let me know if you are not able to find, you can send screenshots of the grade cell Translator via personal DM


Hi Deepti
thank you for your prompt reply.
yes i have been looking at this for a couple of days. the data structures ( the tf) and the and off. I will make another attempt this weekend.
how do I use DM
either way thank you !!

just figure out how to DM. so please ignore.

1 Like

You can also use search tool with mentioned error

InvalidArgumentError: Exception encountered when calling layer ‘key’ (type EinsumDense).

you will find similar post mentioning solutions or issues where to look upon, it might help you.

in case issue persist, you can DM code after trying.


Hi Deepti,
your advice is spot on. I searched and found a solution.
the bug was that I invoked decoder instead of self.decoder.
has nothing to with AI. Sloppy coding instead :frowning:
Thanks again.

1 Like