I encounter error in the last part of this exercise “InvalidArgumentError: cannot compute Einsum as input #1(zero-based) was expected to be a int64 tensor but is a float tensor [Op:Einsum]”.

I searched this and it seems to be related to dtype. However, all my tests passed and I think I cast dtype to float32 when needed correctly. I do not understand what causes this error. Please help! Thanks so much.

Below is my implementation:
{mentor edit: code removed}

thank you very much for your help.
I have another issue with the programming homework.
Whenever I try to compute the code for the decoder model, I keep getting an error during the decoder test. I have cross-checked my code and didn’t find any errors.
this is the error I get: ‘Wrong values in outd’ that is the error for

UNQ_C7 (UNIQUE CELL IDENTIFIER, DO NOT EDIT)

GRADED FUNCTION Decoder.

I would appreciate a little help with this.
kind regards