# Cource4 Week1 Exercise 3 - conv_forward Index Error

I have a trouble with cource4 week1 exercise3 conv_forward assingment.
I`ve got an index error just like below.

``````---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
<ipython-input-125-7e580406a9e8> in <module>
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]
11 cache_0_1_2_3 = cache_conv[0][1][2][3]
12 print("Z's mean =\n", z_mean)

IndexError: index 2 is out of bounds for axis 1 with size 2
``````

I checked my shape of Z but looks fine.

``````                    # 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)
# YOUR CODE ENDS HERE
# Save information in "cache" for the backprop
cache = (A_prev, W, b, hparameters)
print(Z.shape)
return Z, cache
``````

and print(Z.shape) showed me (2, 2, 3, 8).
Since axis1 of Z has two elements, Z[0, 2, 1] invokes index error. That`s OK.
But, I thought that the Z.shape should be (2, 2, 3, 8), i.e. batch * height * width * depth.

Why I made a mistake? And how can I correct this?

Z should have shape `(2, 3, 4, 8)`. Please check your implementation. Here’s the hint from the method:
`Z -- conv output, numpy array of shape (m, n_H, n_W, n_C)`

Thanks you!! balaji.ambresh -san.
When I implemented the shape of Z, I wrote

[snippet deleted by mentor]

and forgot +1…