I am a little confused by what is happening here. Can you advise please.
(pseudo code)
for c in range current_C
a_slice_prev = matrix[vstart : vstop, hstart : hstop, c]
print (“a_slice_prev.shape”, a_slice_prev.shape, “c”, c)

Output
A_slice_prev takes the contents of c as its shape rather than a dimension of 1 - up to a maximum of the number of channels in the input.

a_slice_prev.shape (3, 3, 0) c 0
a_slice_prev.shape (3, 3, 1) c 1
a_slice_prev.shape (3, 3, 2) c 2
a_slice_prev.shape (3, 3, 3) c 3
a_slice_prev.shape (3, 3, 4) c 4
a_slice_prev.shape (3, 3, 4) c 5
a_slice_prev.shape (3, 3, 4) c 6
a_slice_prev.shape (3, 3, 4) c 7
a_slice_prev.shape (3, 3, 0) c 0
a_slice_prev.shape (3, 3, 1) c 1
a_slice_prev.shape (3, 3, 2) c 2
a_slice_prev.shape (3, 3, 3) c 3
a_slice_prev.shape (3, 3, 4) c 4
a_slice_prev.shape (3, 3, 4) c 5
a_slice_prev.shape (3, 3, 4) c 6
a_slice_prev.shape (3, 3, 4) c 7
a_slice_prev.shape (3, 3, 0) c 0

Thanks - but I think I got it - I was using the wrong channel number
although I am still not certain why the contents defined the shape
Ian

The point is that all positions in the input have the same number of channels. You are looping over the output channels, right? For each position, you select for the vertical range, the horizontal range and all input channels.