Hello. My code produces an AL with correct dimensions and values. However, the types of my cache seems to be wrong (got numpy.ndarray but expect tuples). For reference, I have used the list.append(c) function to directly append my “cache” onto the list caches. My lab id is “sjpsvixn”. Does anyone have any ideas of how I might be wrong? Thank you!
Perhaps the syntax you are using for appending to the caches is incorrect. Note that the invocation of the “append” method is not an assignment statement. If I have a list called myList and want to append to it the full syntax is:
myList.append(newElement)
No assignment requlred: it is simply a function invocation.
Note that only the course staff can use the lab ID to view your notebooks. The mentors do not have that “superpower”.
Thanks for the prompt response. Unfortunately I don’t think that is the issue. I used the correct syntax and appended the element “cache” to the list “caches” every iteration. Should I append something else instead?
Have you printed the type of your actual caches value? Are you sure that caches is what the test is complaining about?
I have printed out the type and shape of my actual caches and cache. It seems that my cache values have different shapes, yet I passed all previous exercises with no issues. The type of my AL is numpy.ndarray, which might be the reason why the test is complaining, but casting AL to tuple doesn’t solve the issue.
I figured it out! With your help from this post, I was able to pin down my problem to the linear → sigmoid implementation. Instead of using the “sigmoid” option of linear_activation_forward(), I directly implemented a sigmoid function to feed to cache, causing incorrect shape. Thank you for your help!
It is great news that you found the solution! Thanks for confirming.