C1_W3 UNQ_C1 error on grad_cam

Dear all,

I am getting the following error on the CNQ_C1:

“Code Cell UNQ_C1: Unexpected error (InvalidArgumentError()) occurred during function check. We expected function grad_cam to return type <class ‘numpy.ndarray’>. Please check that this function is defined properly.
Code Cell UNQ_C2: Function ‘compute_gradcam’ is correct.”

As you can see, the subsequent function that requires the former is working correctly. The rest of the demos seem to work correctly as well and the output corresponds to the description expected by the assignment.

Based on this forum and my own work this is what I have done so far:

  1. made sure all of the expressions being used in the UNQ_C1 are correct (using “input_model” instead of “model”)
  2. tried various ways to compute the global average pooling and dot product. Currently I am just using the np.mean and np.dot functions (which seem to be the simplest to execute)
  3. i have restarted the assignment and also re-done it from scratch, only to get the same error. I have very few lines of code in the assignment.

I would be happy to share any of my code, however I do not want to violate community guidelines or take away from someone else’s learning experience.

thank you for your help.

I was able to resolve this issue. One ‘model’ snuck by me and i changed it to “input_model” and it worked fine.

Since many people are having the issue, it may be helpful to be using two different actual models in this lab that way the output of the question would make no-sense, even if it complied correctly.

Thank you!

Thank you for this feedback @pulakgoswami !