Course 4 Week 1 Assignment 1 Exercise 8 - pool_backward (ungraded) AssertionError: Wrong values for mode max

I’ve spent a few days now on the last exercise of this Assignment which is ungraded, but I still can’t fix this error. I usually like to do these assignments on my own but I’ve spent way too long on this exercise and since it’s ungraded I thought it would be okay to ask for help. It’s probably just some silly mistake.

Here is my code and the error message:
{moderator edit - solution code removed}

The thing to remember here is that back prop is the mirror image of forward prop. In forward prop for both pooling and conv layers, we map a “patch” of the input space to a single value in the output space. So that means in back prop we are mapping the gradients from a single point in the output space back to a patch in the input space. Of course with “max” pooling, the gradient update won’t actually modify every point in the input patch.

Note that the RHS of your final assignment statement in the “max” case is not referencing a single point in the output space.

1 Like

And it looks like you are consistent: you’ve made the same conceptual error in the “average” pooling case as well.

Which is actually interesting, because you apparently passed the conv_backward case so you must have gotten it right there. In terms of the way the mapping works, the only difference between conv and pooling is that the pooling treats the layers independently, whereas convolution handles all the input layers in one operation. But the idea of a “patch” or “slice” of the input space mapping to a point in the output space is the same in both cases, modulo what I said in the previous sentence.

1 Like