W2_C4 and W2_C5: Seemingly simple mistakes

Dear Sir or Madam,

Hello!

I have encountered two very strange bugs that should be easily solvable but I have no idea.

For C4, the block below passes the test but the unit tests failed, claiming the dimension is not correct.

For C5, the error is even more strange, it is something like

list indices must be integers or slices, not tuple

I am pretty sure these are small mistakes that can be fixed. However, I keep scratching my head about how to fix it.

Any help is greatly appreciated.

In the second error you are probably doing something like this list(5) instead of doing list[5], or some other variation inside the indexing of the list that its used for tuples.

Try to read a bit about lists and tuples in python.

I don’t think that is the case since the error occurred here.

       tl.Branch( # creates three towers for one input, takes activations and creates queries keys and values
            [?, ?] # queries
            [?, ?] # keys
            [?, ?] # values
        )

I will check where there are other solutions.

OK. I have fixed partial errors on C4 and C5, the problem in C4 is easily solved using

`jnp.shape(?. , (-1, ?,?,?)`

For C_5, I believe there is a small mistake in the original template because it is

type or paste code h    tl.Branch( # creates three towers for one input, takes activations and creates queries keys and values here
            [?, ?] # queries
            [?, ?] # keys
            [?, ?] # values
        )

but it should be

type or paste code here
   tl.Branch( # creates three towers for one input, takes activations and creates queries keys and values
        [?, ?], # queries
        [?, ?], # keys
        [?, ?], # values
    )

There is still an error regarding the shape though. I will try to work it out later.

did you worked it out?

Yes. I have passed the assignment~ it is a simple error.