I do know why but every time I run the code I get this error
NameError Traceback (most recent call last)
in
----> 1 model = djmodel(Tx=30, LSTM_cell=LSTM_cell, densor=densor, reshaper=reshaper)
in djmodel(Tx, LSTM_cell, densor, reshaper)
42 x = Lambda(lambda z:X[:,t,:])(X)
43 # Step 2.B: Use reshaper to reshape x to be (1, n_values) (≈1 line)
—> 44 x = reshapor(x)
45 # Step 2.C: Perform one step of the LSTM_cell
46 a, _, c = LSTM_cell(inputs=x, initial_state=[a, c])
Hey @eag , learners are not supposed to publicly post code on Discourse. I understand in some cases the only way to help is to look at the code, in that scenario, please wait for a mentor to reach out to you, asking for it.
Next time if you post code publicly your post may be deleted.
Now changing by reshaper I get the model summary model but not the model loss. This is the error `Test failed
Expected value
[‘TensorFlowOpLayer’, [(None, 90)], 0]
does not match the input value:
[‘Lambda’, (None, 90), 0]
AssertionError Traceback (most recent call last)
in
1 # UNIT TEST
2 output = summary(model)
----> 3 comparator(output, djmodel_out)
~/work/W1A3/test_utils.py in comparator(learner, instructor)
23 “\n\n does not match the input value: \n\n”,
24 colored(f"{a}", “red”))
—> 25 raise AssertionError(“Error in test”)
26 print(colored(“All tests passed!”, “green”))
27
I am afraid I am as stuck as you my friend. I even tried to look up in the literature on the website Papers with Code. But I did not even find a snippet to figure out the solution.
My error was - I was using Lambda for step 2A. I replaced this with regular python splicing, and everything then passed. So… give that a try. Maybe that works for you as well.
Just use the normal np way to slice it. I had the same error msg, after spending hours seeking a solution, finally solved it by re-running the whole notebook .
I’m stuck with the same place (djmodel)… I did not use the ‘lambda’ script myself - but using it did not help. So, the problem appears at UNIT TEST with the warning:
AttributeError: The layer “reshape” 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.
All of a sudden, it works now (on a different computer – but how could that matter?)
After trying a lot, I got that function “def music_inference_model(LSTM_cell, densor, Ty=100):” works properly. I see that many of my colleges have some problems with that function. In fact, the instructions of the exercises need major details, I had to search a lot in google to code that function. However, I have an error with this line “inference_summary = summary(inference_model)”, which is part of the proporcionated code for this course. The following error is displayed: " 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."
After that, my output in the line “results, indices = predict_and_sample(inference_model, x_initializer, a_initializer, c_initializer)” differs from the expected output.
Finally, in the excersices from 3.2 - Generate Music, I have the following error "ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
Using a basic midi to wav parser you can have a rough idea about the audio clip generated by this model. The parser is very limited.".
Please help me to solve this problems, Thanks in advance
@alvaro.ortega I was getting exactly the same AttributeError. I noticed that another post had the problem go away when run on another computer. I did a save/checkpoint the restarted the kernel and ran each of the modules and it worked. I even got a bit of midi music output.