Course 1 Week 4 Exercise 5: type error


I am currently struggling with the 5th exercise (L_model_forward) of week 4 assignement.
I cannot find the error. As a result I get AL = [[0.03921668 0.70498921 0.19734387 0.04728177]]
and the expected output is exactly the same. Somehow it has to do with the class types of my array.

Hi @Markito, You have posted your coding work which is a violation of the Code of Conduct. Before we get going, please delete your code block from your post.

Hi Kenb,

I am very sorry, I totally missed this. I now deleted my code. I hope you still can help me out with this.

Thank you very much!


Hi @Markito, if I read the assertion error I think you are right in pointing out that the problem has to do with the data type (data type list is expected, and somehow it receives a nonetype. Do you go over the hints for the implementation of the functions at the top of the exercise, i.e. the use of the append function to add to a list?

Since it seems this was never addressed, I just had this same issue. I made a mistake in how the cache values were being saved, as my perception of what I needed to cache was incorrect.
My advice would be to reexamine exercise 4, understand that you can operate it for both activation functions - ReLU and sigmoid, and that the variable cache operates independent of the activation function.
My error came from the idea that I only needed part of the cache tuple, I was being thrown off by the verbiage and ‘linear’ and 'activation, for an unbeknown reason.