Hi,
The following error message was given by the grader: “Unexpected error (AttributeError(”‘NoneType’ object has no attribute ‘type’",)) occurred during function check. We expected function grad_cam
to return type <class ‘numpy.ndarray’>. Please check that this function is defined properly."
However, after several checks, I am very sure that the output of the cam object is a numpy type. The output of the function passes all the test and logical.
This last questions is preventing me from a 4/4 to complete the course. Please advise
Hi @Winson_Lam,
The error message is telling you that something is wrong with your function. Please check whether you replaced all instances of “None” with your code and whether all the defined dimensions, etc. are correct.
Try to add some print statements to see the actual values that variables actually have in the code.
Hi Sivanola,
Thanks for the reply. I have tried your suggests and spent an hour on trying to find out where the problem is in my function.
Would you be able to provide a bit more tips to help me locate the problem? The only instance of None is the “cam = None” that is above the “Start Code Here section”. I wonder if that was what you were referring to?
Hi @Winson_Lam,
I wonder about your statement that you got a type error even though you’re returning a numpy array type.
Since it is difficult to give specific advice based on the error message alone, it would be helpful if you could share your code, especially at the function “grad_cam”.
Hi @nakamura, thank you for your message. I rummaged some old posts and found the common mistake that people make when they follow the examples leading to UNG_C1, the variable names can sometimes get confused. I have solved the problem and passed. Thank you and everybody else contributing to this amazing course. 
2 Likes
Hi,
I have the same problem. Can you help me to solve this error?
@Winson_Lam Please, show your full error message. Your error message should mention any specific line.
Hi all, I have passed the course.
However, anyone else who are still stuck, I basically realised I used an external object “model” inside the grad_cam function, then I replaced it with the internal object “input_model”, and this solved my problem. It was the same problem I found in the discussion forum over at the coursera page.
2 Likes