Course 5- Assignment 1- Problem 6- List Attribute Error

Am getting this error message: AttributeError: ‘list’ object has no attribute ‘shape’. Have looked at the compiler and see that it is a result of x1.shape. Odds are, I am likely doing something wrong. I have a code sample listed below.

# Retrieve values from the first cache (t=1) of caches (≈2 lines)
(caches, x) = caches
(a1, a0, x1, parameters) = caches[0]

# Retrieve dimensions from da's and x1's shapes (≈2 lines)
n_a, m, T_x = da.shape
n_x, m = x1.shape

Any help/assistance/advice that can be given would be greatly appreciated.

Please post a screen capture image that shows the error message.

Here is a screenshot of the error that I am getting. Odds are, there is some code snippet that I need to adjust here.

Where does x1 come from?

x1 is one of the parameters that is in the problem. As can be seen in my first image, x1 is initialized as well as a1, a0, and parameters. This is initialized to caches[0]. Odds are, this snippet of code needs to be adjusted.

Perhaps there is a problem with the data being passed to rnn_backward() in the “caches” variable. Could be a defect in your rnn_forward().

That is likely the case. Would it be alright if I posted the code just to show you what I am looking at here? Code will be deleted once a solution is found.

Have done that. Any advice/suggestions you can give would be greatly appreciated.

Maybe one of the other mentors for this course will be able to assist.

If any mentor can help on this, that would be great. Am willing to DM the code images to them as well.

Hello Jackson,

Based on your error log, you are not initializing the gradient with right sizes, So check the previous cell and if you have recalled with the right shape. What I felt you are missing a code work especially related to x1.shape

In case you are not able to get where you could be going wrong, share the grader cell via personal DM.

Regards
DP