If u’re still stuck, please take a look at the following hints cuz I had the same issue:
Follow these instructions carefully which I obtained from here:
Preparation
Retreive information (m, n_H_prev, n_W_prev, n_C_prev) from A_prev and (f, f, n_C_prev, n_C) from W using .shape
Retreive stride and padding from hparameters python dictionnary
calculate n_H and n_W using the formula and the int() function as floor
initialize Z using .zeros with dimensions (m ,n_H, n_W, n_C)
use zero_pad() function to add padding to A_prev (result: A_prev_pad)
Loops:
first for loop:
loop over m Examples using index i and extract a_prev_pad from A_prev_pad using index in the first axis position
second for loop:
loop over vertical output layer axis (n_H) using index h and calculate (vert_start, vert_end):
multiply stride to index h for vert_start
add filter height f for vert_end
third for loop:
loop over horizontal output layer axis (n_W) using index w and calculate (horiz_start, horiz_end):
multiply stride to index w for horiz_start
add filter width f for horiz_end
fourth for loop:
loop over the number of output channels using index c
slice out a_slice_prev from a_prev_pad using [vert_start:vert_end, horiz_start:horiz_end, all]
slice out weights from W using [all, all, all, c]
slice out biases from b using [0, 0, 0, c]
calculate Z[i, h, w, c] using function conv_single_step() with inputs a_slice_prev, weights and biases
Please pay specific attention to the bold texts and also bold + italic in my comment! U’d definitely fix the problem
Cheers,