I have trouble fixing the error
“AttributeError: The layer “lstm_1” has multiple inbound nodes, with different output shapes. Hence the notion of “output shape” is ill-defined for the layer. Use get_output_shape_at(node_index) instead.”

This is how I wrote the code for Step2,Step3 for ’ Exercise 2 - music_inference_model’

{moderator edit - solution code removed}

Any help is really appriciated

Sequence Models week-1 lab-help

To get the last axis, the easiest way is to use -1.

1 Like

Yes, I also think that it’s the argmax call that is probably causing the issue there. I added a bunch of prints to my code to show the shapes and here’s what I see (repeated of course):

out.shape before arg_max (None, 90)
x.shape before one_hot (None,)
x.shape after one_hot (None, 90)
x.shape after RepeatVector (None, 1, 90)

What do you see if you try that?

Also note that the output_type is not necessary there: that will happen automatically. But it does no harm …

1 Like

Actually I tried it your way and it seems to work for me. Are you sure you are running the current version of your code? If you type new code in a function cell and then just call it again, it runs the old code. You have to click “Shift-Enter” on the changed cell to get the new code loaded.

Try a fresh start by doing:

Kernel -> Restart and Clear Output
Cell -> Run All

And see whether you still get the same error. That just makes sure everything is in a consistent state and you are running the current version of your code.

1 Like

Hi Paul,
Yes I have the same outputs for the x and out shapes.
Still I am getting the same error .

Hi Saif,
Did you mean “tf.math.argmax(out, axis =-1 )” like this?
I did and still i got the same error.

I did this too … but still the same

Ok, it’s time to look at your source code. We aren’t supposed to do that in a public way, but there is a private way to do it. I will send you a DM (Direct Message) about how to proceed.

1 Like