DLS Course 4 Week 1 - Convolution_model_Step_by_Step_v1 - Exercise 3


I am getting “Index Error: too many indices for array” in Exercise 3 - attached the screenshot below.
I verified the shapes of below variables. Requesting your help. Thanks.

A_prev is (2, 5, 7, 4)
W is (3, 3, 4, 8)
A_prev_pad is (2, 7, 9, 4)
n_C_prev is 4

a_slice_prev is (3, 3)
weights is (3,3)
biases is (1, 1, 1)

Hello @trelango,

Judging from the traceback, it seems to be complaining about Z[i, h, w, c] that using 4 indices is too many for Z.

Now, it is a part of the exercise that we need to # Initialize the output volume Z with zeros. (≈1 line). Did you initialize Z properly to a 4-D array?


I have wrongly initialized Z with the shape (3, 4) and it is now corrected. I am facing different issue and working on it. Thanks a lot for your support Raymond.

OK, @trelango! :slight_smile: