# Convolution step by step week 1 assignment 3

Please i am stuck i keep getting this error IndexError: too many indices for array
i guess i am missing something in the shape of my arrays

``````---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
<ipython-input-94-7e580406a9e8> in <module>
6                "stride": 2}
7
----> 8 Z, cache_conv = conv_forward(A_prev, W, b, hparameters)
9 z_mean = np.mean(Z)
10 z_0_2_1 = Z[0, 2, 1]

<ipython-input-93-13456c5602e3> in conv_forward(A_prev, W, b, hparameters)
59                     weights = W[:,:,:,c]
60                     biases = b[:,:,:,c]
---> 61                     Z[i, h, w, c] = conv_single_step(a_slice_prev, weights, biases)
62     # YOUR CODE STARTS HERE
63

IndexError: too many indices for array
``````

these are some initialisations i did

``````# Initialize the output volume Z with zeros. (≈1 line)
Z = np.zeros(4)

for i in range(m):               # loop over the batch of training examples
``````

and in the last for loop these was how i endedn it

`````` a_slice_prev = a_prev_pad[vert_start:vert_end, horiz_start:horiz_end,:]

# Convolve the (3D) slice with the correct filter W and bias b, to get back one output neuron. (≈3 line)
weights = W[:,:,:,c]
biases = b[:,:,:,c]
Z[i, h, w, c] = conv_single_step(a_slice_prev, weights, biases)
``````

What is the shape of `Z` after executing that statement?

How many dimensions must `Z` have in order to do an assignment like this …

``````Z[i,h,w,c] = x
``````