It looks like you did not apply all the suggestions in that other thread. In particular you missed this one:
And this one:
It also appears that you have something wrong with the output w dimension. The h value is correct, but you’re using the input w value. So you need to look carefully to see how that happened. Here’s my output from that test cell including some added print statements to show various shapes:
stride 2 pad 1
New dimensions = 3 by 4
Shape Z = (2, 3, 4, 8)
Shape A_prev_pad = (2, 7, 9, 4)
Z[0,0,0,0] = -2.651123629553914
Z[1,2,3,7] = 0.4427056509973153
Z's mean =
0.5511276474566768
Z[0,2,1] =
[-2.17796037 8.07171329 -0.5772704 3.36286738 4.48113645 -2.89198428
10.99288867 3.03171932]
cache_conv[0][1][2][3] =
[-1.1191154 1.9560789 -0.3264995 -1.34267579]
First Test: All tests passed!
Thanks. My bug was that I used A_prev_pad instead of a_prev_pad for a_slice_prev, and I did not initialize Z to be 4 dimensional. I also used “f” for num_filters in the for loop instead of the “n_” parameter. Thanks for the help!