Week 2 exercise 8 - Type Error about Tuple Indices

Hello everyone,

I am have completed the rest of the notebook. However, when I try to test the model using model_test, I am getting a Type Error.
TypeError: tuple indices must be integers or slices, not str

However, the model works.

I am not understanding what is the problem. Please do help me! Thank you in advance!

Hello anyone who is checking this thread. I am sorry, but I figured out what was the problem. Instead of returning the dictionary ‘d’ which was already coded into the function, I was returning only params, cost and grad.

It’s good to hear that you figured out the solution. Just as a general rule, note that the return values for the function are defined in the template code that is given to you. There should be no need to change the template code.