Errors encountered for L_model_forward

I got to exercise L_model_forward and I am stuck there. I was able to obtain good values for AL, but the function L_model_forward_test(L_model_forward) reports the errors below. Am I supposed to use a function to convert from an array to a tuple?

Error: The function should return a numpy array. in variable 0. Got type: <class ‘numpy.ndarray’> but expected type <class ‘tuple’>
Error: The function should return a numpy array. in variable 1. Got type: <class ‘numpy.ndarray’> but expected type <class ‘tuple’>
Error: The function should return a numpy array. in variable 2. Got type: <class ‘numpy.ndarray’> but expected type <class ‘tuple’>
Error: Wrong shape for variable 0.
Error: Wrong shape for variable 1.
Error: Wrong shape for variable 2.
Error: Wrong shape for variable 1.
Error: Wrong shape for variable 0.

If you are:

  1. Using linear_activation_forward and updating caches correctly
  2. Returning a tuple of size 2 from the function L_model_forward with the right entries

please my name and message your notebook as an attachment.

You should not append A or AL to caches. Fix those to pass the tests.

1 Like

Thanks, I was so dumb for not checking the return of linear_activation_forward() function. Somehow, in my mind A and cache were identical. I could have printed them to see what they contain.