I am not getting the correct number of output layers as in the expected model summary in Neural Machine Translation Exercise 3 modelf() from the model I built. I only differ by one. I total 10 output layers, but the assert statement is false since I am getting only 9. Where would I find the count of output layers?
Hello, @Steven22!
To just find the count of output layers, certainly, you might just use the code in the assert → because it is doing exactly that.
However, the more interesting thing here, which is probably how I would start debugging this, is to start tracing from model.outputs
because it was, as you know, provided by us in the exercise 2 when we filled in the blanks to define modelf(...)
.
If we look at the step 3 of the exercise, we were asked to create the model by specifying the list of outputs:
and that outputs is the outputs that triggered you that error! So how did that outputs come from? Right?
Well, then we go back to one step before which is step 2 of the exercise because that is the place we, as the exercise asked, appended some out
to the outputs
. Then the question is, what controlled the number of out
to be appended? We should ask this because 10 was expected but we got only 9! The answer is the loop! Right? You append as many out
as the number of times it loops. Then what controlled the number of loops? I will leave it to you from here.
Here is my recommendations:
- Do the traceback as I suggested above.
- When traceback, we only read the code by our eyes. We may see that the code looks fine to our eyes but we do not know what actually the jupyter’s Python kernel contains for each variable until we actually print the variable’s value out. Sometimes, we expect a variable called
a
to contain a value of10
, and the line of code also readsa = 10
, but it is possible that when you printa
out, it turned out to be another value because we had somehow changed it in an unwanted way which is not the plan. So, throughout your traceback, for anything you read to be fine,print
it out to make sure Jupyter reads the same.
Good luck for your debugging! Let us know how it goes!
Cheers,
Raymond
I agree, check your code in steps 2.C and 2.D.
Thank you for your assistance. Raymond, I didn’t have my indexing variable set correctly.
You are welcome, @Steven22!
-Raymond