DLS C5 W1 A3 E2 "Assertion Error"

{moderator edit - solution code removed}

return inference_model

AssertionError Traceback (most recent call last)
4 inference_summary = summary(inference_model)
----> 5 comparator(inference_summary, music_inference_model_out)

~/work/W1A3/test_utils.py in comparator(learner, instructor)
16 def comparator(learner, instructor):
17 if len(learner) != len(instructor):
—> 18 raise AssertionError(“Error in test. The lists contain a different number of elements”)
19 for index, a in enumerate(instructor):
20 b = learner[index]

AssertionError: Error in test. The lists contain a different number of elements

I think something is wrong with the Lambda function. Why not do the code without it?

You have given that:

# Step 2.D: 
# Select the next value according to "out",
# Set "x" to be the one-hot representation of the selected value
# See instructions above.
x = None
x = None

So, for the first x, use tf.math.argmax and for the second x, use tf.one_hot.


Nothing in the instructions tells you to use a Lambda function.
I recommend against that approach.

1 Like

Thanks a lot! It really helped me