Test failed at index 1 Expected value ['SlicingOpLambda', (None, 90), 0]

Hello, I downloaded the notebook for Week 1 assignment 3 into my laptop and run it but the error arises as seen below. I did 100/100 for the grader output. I am not sure why this is happening.


output = summary(model)
comparator(output, djmodel_out)

Test failed at index 1
Expected value

[‘SlicingOpLambda’, (None, 90), 0]

does not match the input value:

[‘TensorFlowOpLayer’, [(None, 90)], 0]

AssertionError Traceback (most recent call last)
2 output = summary(model)
----> 3 comparator(output, djmodel_out)

~/Desktop/Python/Deep Learning Specialisation/5-Sequence Models/test_utils2.py in comparator(learner, instructor)
26 “\n\n does not match the input value: \n\n”,
27 colored(f"{a}", “red”))
—> 28 raise AssertionError(“Error in test”)
29 print(colored(“All tests passed!”, “green”))

AssertionError: Error in test

Are you trying to run the notebooks locally on your computer, instead of using the Coursera platform?

Yes i am. I hope to utilise what i learnt here on my local laptop too. But it doesn’t seem to operate as per coursera’s environment

Sorry, I don’t have any experience with that.

Those tests do not necessarily mean you won’t be able to reproduce Jazz music. I had the same error but was able to generate music.
I guess the issue is the different versions of python libraries installed on Coursera.
For instance, I usually get the warning

serWarning: The lr argument is deprecated, use learning_rate instead.
super(Adam, self).init(name, **kwargs)

Changing it to “learning_rate” removes the warning.

So, even without “All tests passed!” your code could serve its purpose.

Hope this helps

I struggled a bit with this issue… but @TMosh 's question about using a local environment versus Coursera’s made me check on the cloud vs my computer’s output.

‘SlicingOpLambda’ is what I get locally and ‘TensorFlowOpLayer’ is what is expected. I guess this has to do with different TensorFlow versions, I’m using tensorflow-macos==2.10.0 and on the Coursera I believe is 2.6 or something else…

On Coursera’s environment all tests pass.