C4W1PA1 Exercise 5 - conv_backward


I have completed the task, however I cannot seem to understand why this line is needed:

    # Set the ith training example's dA_prev to the unpadded da_prev_pad (Hint: use X[pad:-pad, pad:-pad, :])
    # dA_prev[i, :, :, :] = None

I have tried printing outputs of both da_prev_pad and dA_prev[i, :, :, :], and I understand what it is slicing. However, I cannot seem to grasp why we are leaving out the other parts (is that considered to be some form of artifical information?).

Thanks in advance for the time and help :slight_smile:

Hi Endrit,

Notice that da_prev_pad was padded first in order to be able to perform backpropagation, which requires (padded) convolution as explained here. To just keep the values of da_prev rather than include the padding, it needs to be removed again, as explained here.

Thanks for the explanation! I will take a look at the files :slight_smile: