conv_forward
and pool_forward
both have a three layer nested loop which loops through a_prev_pad
and a_prev
, respectively.
I don’t fully understand why a_slice_prev = a_prev_pad[vert_start:vert_end, horiz_start:horiz_end,:]
for con_forward
only needs 3 dimensions (it’s a 4 dimension array) while pool_forward
's a_prev_slice = A_prev[i,vert_start:vert_end, horiz_start:horiz_end,c]
requires all 4.
I know it has something to do with the fact that a_slide_prev
for conv_forward
is being multiplied by W vector but I still don’t fully understand why
I believe it’s because the key difference is that pooling is applied independently to each channel (hence the 4D loop in pool_forward), while convolution combines information across all channels in one operation (hence the 3D slice in conv_forward with a separate loop to handle different filters). However, in both scenarios you still have m
amount of inputs which you need to apply the pooling filter or the convolution to.