Course 4 Week 1 Exercise 3 Step by Step... Operands could not be broadcast together with shapes

I think I have an index problem? I go for a while with a_slice_prev being a [3,3,4]
W is the same [3,3,4] with b as a [1,1,1]…

then a_slice_prev goes to a [3,1,4]… shape… Any pointers as to where I need to focus… not good with this multidimensional stuff…

thanks,

rick

stride 2
pad 1
n_H 3
n_W 4
Z [[[[0. 0. 0. 0. 0. 0. 0. 0.]
[0. 0. 0. 0. 0. 0. 0. 0.]
[0. 0. 0. 0. 0. 0. 0. 0.]
[0. 0. 0. 0. 0. 0. 0. 0.]]

[[0. 0. 0. 0. 0. 0. 0. 0.]
[0. 0. 0. 0. 0. 0. 0. 0.]
[0. 0. 0. 0. 0. 0. 0. 0.]
[0. 0. 0. 0. 0. 0. 0. 0.]]

[[0. 0. 0. 0. 0. 0. 0. 0.]
[0. 0. 0. 0. 0. 0. 0. 0.]
[0. 0. 0. 0. 0. 0. 0. 0.]
[0. 0. 0. 0. 0. 0. 0. 0.]]]

[[[0. 0. 0. 0. 0. 0. 0. 0.]
[0. 0. 0. 0. 0. 0. 0. 0.]
[0. 0. 0. 0. 0. 0. 0. 0.]
[0. 0. 0. 0. 0. 0. 0. 0.]]

[[0. 0. 0. 0. 0. 0. 0. 0.]
[0. 0. 0. 0. 0. 0. 0. 0.]
[0. 0. 0. 0. 0. 0. 0. 0.]
[0. 0. 0. 0. 0. 0. 0. 0.]]

[[0. 0. 0. 0. 0. 0. 0. 0.]
[0. 0. 0. 0. 0. 0. 0. 0.]
[0. 0. 0. 0. 0. 0. 0. 0.]
[0. 0. 0. 0. 0. 0. 0. 0.]]]]
A_prev_pad shape (2, 7, 9, 4)
A_prev_pad [[[[ 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00]
[ 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00]
[ 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00]
[ 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00]
[ 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00]
[ 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00]
[ 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00]
[ 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00]
[ 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00]]

[[ 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00]
[ 1.62434536e+00 -6.11756414e-01 -5.28171752e-01 -1.07296862e+00]
[ 8.65407629e-01 -2.30153870e+00 1.74481176e+00 -7.61206901e-01]
[ 3.19039096e-01 -2.49370375e-01 1.46210794e+00 -2.06014071e+00]
[-3.22417204e-01 -3.84054355e-01 1.13376944e+00 -1.09989127e+00]
[-1.72428208e-01 -8.77858418e-01 4.22137467e-02 5.82815214e-01]
[-1.10061918e+00 1.14472371e+00 9.01590721e-01 5.02494339e-01]
[ 9.00855949e-01 -6.83727859e-01 -1.22890226e-01 -9.35769434e-01]
[ 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00]]

[[ 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00]
[-2.67888080e-01 5.30355467e-01 -6.91660752e-01 -3.96753527e-01]
[-6.87172700e-01 -8.45205641e-01 -6.71246131e-01 -1.26645989e-02]
[-1.11731035e+00 2.34415698e-01 1.65980218e+00 7.42044161e-01]
[-1.91835552e-01 -8.87628964e-01 -7.47158294e-01 1.69245460e+00]
[ 5.08077548e-02 -6.36995647e-01 1.90915485e-01 2.10025514e+00]
[ 1.20158952e-01 6.17203110e-01 3.00170320e-01 -3.52249846e-01]
[-1.14251820e+00 -3.49342722e-01 -2.08894233e-01 5.86623191e-01]
[ 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00]]

[[ 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00]
[ 8.38983414e-01 9.31102081e-01 2.85587325e-01 8.85141164e-01]
[-7.54397941e-01 1.25286816e+00 5.12929820e-01 -2.98092835e-01]
[ 4.88518147e-01 -7.55717130e-02 1.13162939e+00 1.51981682e+00]
[ 2.18557541e+00 -1.39649634e+00 -1.44411381e+00 -5.04465863e-01]
[ 1.60037069e-01 8.76168921e-01 3.15634947e-01 -2.02220122e+00]
[-3.06204013e-01 8.27974643e-01 2.30094735e-01 7.62011180e-01]
[-2.22328143e-01 -2.00758069e-01 1.86561391e-01 4.10051647e-01]
[ 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00]]

[[ 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00]
[ 1.98299720e-01 1.19008646e-01 -6.70662286e-01 3.77563786e-01]
[ 1.21821271e-01 1.12948391e+00 1.19891788e+00 1.85156417e-01]
[-3.75284950e-01 -6.38730407e-01 4.23494354e-01 7.73400683e-02]
[-3.43853676e-01 4.35968568e-02 -6.20000844e-01 6.98032034e-01]
[-4.47128565e-01 1.22450770e+00 4.03491642e-01 5.93578523e-01]
[-1.09491185e+00 1.69382433e-01 7.40556451e-01 -9.53700602e-01]
[-2.66218506e-01 3.26145467e-02 -1.37311732e+00 3.15159392e-01]
[ 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00]]

[[ 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00]
[ 8.46160648e-01 -8.59515941e-01 3.50545979e-01 -1.31228341e+00]
[-3.86955093e-02 -1.61577235e+00 1.12141771e+00 4.08900538e-01]
[-2.46169559e-02 -7.75161619e-01 1.27375593e+00 1.96710175e+00]
[-1.85798186e+00 1.23616403e+00 1.62765075e+00 3.38011697e-01]
[-1.19926803e+00 8.63345318e-01 -1.80920302e-01 -6.03920628e-01]
[-1.23005814e+00 5.50537496e-01 7.92806866e-01 -6.23530730e-01]
[ 5.20576337e-01 -1.14434139e+00 8.01861032e-01 4.65672984e-02]
[ 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00]]

[[ 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00]
[ 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00]
[ 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00]
[ 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00]
[ 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00]
[ 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00]
[ 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00]
[ 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00]
[ 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00]]]

[[[ 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00]
[ 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00]
[ 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00]
[ 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00]
[ 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00]
[ 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00]
[ 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00]
[ 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00]
[ 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00]]

[[ 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00]
[-1.86569772e-01 -1.01745873e-01 8.68886157e-01 7.50411640e-01]
[ 5.29465324e-01 1.37701210e-01 7.78211279e-02 6.18380262e-01]
[ 2.32494559e-01 6.82551407e-01 -3.10116774e-01 -2.43483776e+00]
[ 1.03882460e+00 2.18697965e+00 4.41364444e-01 -1.00155233e-01]
[-1.36444744e-01 -1.19054188e-01 1.74094083e-02 -1.12201873e+00]
[-5.17094458e-01 -9.97026828e-01 2.48799161e-01 -2.96641152e-01]
[ 4.95211324e-01 -1.74703160e-01 9.86335188e-01 2.13533901e-01]
[ 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00]]

[[ 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00]
[ 2.19069973e+00 -1.89636092e+00 -6.46916688e-01 9.01486892e-01]
[ 2.52832571e+00 -2.48634778e-01 4.36689932e-02 -2.26314243e-01]
[ 1.33145711e+00 -2.87307863e-01 6.80069840e-01 -3.19801599e-01]
[-1.27255876e+00 3.13547720e-01 5.03184813e-01 1.29322588e+00]
[-1.10447026e-01 -6.17362064e-01 5.62761097e-01 2.40737092e-01]
[ 2.80665077e-01 -7.31127037e-02 1.16033857e+00 3.69492716e-01]
[ 1.90465871e+00 1.11105670e+00 6.59049796e-01 -1.62743834e+00]
[ 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00]]

[[ 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00]
[ 6.02319280e-01 4.20282204e-01 8.10951673e-01 1.04444209e+00]
[-4.00878192e-01 8.24005618e-01 -5.62305431e-01 1.95487808e+00]
[-1.33195167e+00 -1.76068856e+00 -1.65072127e+00 -8.90555584e-01]
[-1.11911540e+00 1.95607890e+00 -3.26499498e-01 -1.34267579e+00]
[ 1.11438298e+00 -5.86523939e-01 -1.23685338e+00 8.75838928e-01]
[ 6.23362177e-01 -4.34956683e-01 1.40754000e+00 1.29101580e-01]
[ 1.61694960e+00 5.02740882e-01 1.55880554e+00 1.09402696e-01]
[ 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00]]

[[ 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00]
[-1.21974440e+00 2.44936865e+00 -5.45774168e-01 -1.98837863e-01]
[-7.00398505e-01 -2.03394449e-01 2.42669441e-01 2.01830179e-01]
[ 6.61020288e-01 1.79215821e+00 -1.20464572e-01 -1.23312074e+00]
[-1.18231813e+00 -6.65754518e-01 -1.67419581e+00 8.25029824e-01]
[-4.98213564e-01 -3.10984978e-01 -1.89148284e-03 -1.39662042e+00]
[-8.61316361e-01 6.74711526e-01 6.18539131e-01 -4.43171931e-01]
[ 1.81053491e+00 -1.30572692e+00 -3.44987210e-01 -2.30839743e-01]
[ 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00]]

[[ 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00]
[-2.79308500e+00 1.93752881e+00 3.66332015e-01 -1.04458938e+00]
[ 2.05117344e+00 5.85662000e-01 4.29526140e-01 -6.06998398e-01]
[ 1.06222724e-01 -1.52568032e+00 7.95026094e-01 -3.74438319e-01]
[ 1.34048197e-01 1.20205486e+00 2.84748111e-01 2.62467445e-01]
[ 2.76499305e-01 -7.33271604e-01 8.36004719e-01 1.54335911e+00]
[ 7.58805660e-01 8.84908814e-01 -8.77281519e-01 -8.67787223e-01]
[-1.44087602e+00 1.23225307e+00 -2.54179868e-01 1.39984394e+00]
[ 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00]]

[[ 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00]
[ 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00]
[ 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00]
[ 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00]
[ 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00]
[ 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00]
[ 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00]
[ 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00]
[ 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00]]]]
a_prev_pad shape before loop… (5, 7, 4)
a_prev_pad before [[[ 1.62434536 -0.61175641 -0.52817175 -1.07296862]
[ 0.86540763 -2.3015387 1.74481176 -0.7612069 ]
[ 0.3190391 -0.24937038 1.46210794 -2.06014071]
[-0.3224172 -0.38405435 1.13376944 -1.09989127]
[-0.17242821 -0.87785842 0.04221375 0.58281521]
[-1.10061918 1.14472371 0.90159072 0.50249434]
[ 0.90085595 -0.68372786 -0.12289023 -0.93576943]]

[[-0.26788808 0.53035547 -0.69166075 -0.39675353]
[-0.6871727 -0.84520564 -0.67124613 -0.0126646 ]
[-1.11731035 0.2344157 1.65980218 0.74204416]
[-0.19183555 -0.88762896 -0.74715829 1.6924546 ]
[ 0.05080775 -0.63699565 0.19091548 2.10025514]
[ 0.12015895 0.61720311 0.30017032 -0.35224985]
[-1.1425182 -0.34934272 -0.20889423 0.58662319]]

[[ 0.83898341 0.93110208 0.28558733 0.88514116]
[-0.75439794 1.25286816 0.51292982 -0.29809284]
[ 0.48851815 -0.07557171 1.13162939 1.51981682]
[ 2.18557541 -1.39649634 -1.44411381 -0.50446586]
[ 0.16003707 0.87616892 0.31563495 -2.02220122]
[-0.30620401 0.82797464 0.23009474 0.76201118]
[-0.22232814 -0.20075807 0.18656139 0.41005165]]

[[ 0.19829972 0.11900865 -0.67066229 0.37756379]
[ 0.12182127 1.12948391 1.19891788 0.18515642]
[-0.37528495 -0.63873041 0.42349435 0.07734007]
[-0.34385368 0.04359686 -0.62000084 0.69803203]
[-0.44712856 1.2245077 0.40349164 0.59357852]
[-1.09491185 0.16938243 0.74055645 -0.9537006 ]
[-0.26621851 0.03261455 -1.37311732 0.31515939]]

[[ 0.84616065 -0.85951594 0.35054598 -1.31228341]
[-0.03869551 -1.61577235 1.12141771 0.40890054]
[-0.02461696 -0.77516162 1.27375593 1.96710175]
[-1.85798186 1.23616403 1.62765075 0.3380117 ]
[-1.19926803 0.86334532 -0.1809203 -0.60392063]
[-1.23005814 0.5505375 0.79280687 -0.62353073]
[ 0.52057634 -1.14434139 0.80186103 0.0465673 ]]]
m 2 n_H_prev 5 n_W_prev 7 n_C_prev 4

indexes i 0 h 0 w 0 c 0

Vertical index 0 : 3
Horizantal Index 0 : 3
a_slice shape (3, 3, 4)
a_slice_prev [[[ 1.62434536 -0.61175641 -0.52817175 -1.07296862]
[ 0.86540763 -2.3015387 1.74481176 -0.7612069 ]
[ 0.3190391 -0.24937038 1.46210794 -2.06014071]]

[[-0.26788808 0.53035547 -0.69166075 -0.39675353]
[-0.6871727 -0.84520564 -0.67124613 -0.0126646 ]
[-1.11731035 0.2344157 1.65980218 0.74204416]]

[[ 0.83898341 0.93110208 0.28558733 0.88514116]
[-0.75439794 1.25286816 0.51292982 -0.29809284]
[ 0.48851815 -0.07557171 1.13162939 1.51981682]]]
wshape (3, 3, 4) weights [[[-0.78191168 -1.11647002 0.417302 -0.27909772]
[ 1.3887794 -0.13597733 -0.23794194 -2.03720123]
[-0.10999149 -0.19505734 -0.55749472 0.58464661]]

[[ 2.13782807 0.61798553 -0.47537288 -1.30653407]
[ 0.45161595 -0.77785883 2.0546241 0.84086156]
[ 0.45128402 -0.38483225 -0.82246719 -0.0693287 ]]

[[-0.19899818 0.5154138 1.04008915 0.52887975]
[-0.25898285 0.16986926 1.44287693 0.63658341]
[ 0.68400133 -2.22711263 1.01120706 0.85328219]]]
bShape (1, 1, 1) biases [[[-1.39881282]]]
m 2 n_H_prev 5 n_W_prev 7 n_C_prev 4

indexes i 0 h 0 w 0 c 1

Vertical index 0 : 3
Horizantal Index 0 : 3
a_slice shape (3, 3, 4)
a_slice_prev [[[ 1.62434536 -0.61175641 -0.52817175 -1.07296862]
[ 0.86540763 -2.3015387 1.74481176 -0.7612069 ]
[ 0.3190391 -0.24937038 1.46210794 -2.06014071]]

[[-0.26788808 0.53035547 -0.69166075 -0.39675353]
[-0.6871727 -0.84520564 -0.67124613 -0.0126646 ]
[-1.11731035 0.2344157 1.65980218 0.74204416]]

[[ 0.83898341 0.93110208 0.28558733 0.88514116]
[-0.75439794 1.25286816 0.51292982 -0.29809284]
[ 0.48851815 -0.07557171 1.13162939 1.51981682]]]
wshape (3, 3, 4) weights [[[-0.43750898 0.0809271 0.78477065 1.62284909]
[-0.66134424 -0.79726979 1.15528789 -1.94258918]
[ 0.00854895 0.80539342 0.93916874 0.32427424]]

[[-0.785534 -0.18417633 0.47761018 0.07638048]
[ 1.10417433 1.11584111 0.05340954 -0.10288722]
[-1.68405999 1.45810824 0.72171129 -0.10839207]]

[[ 1.86647138 -1.11487105 -0.91844004 -2.23708651]
[ 0.1892932 -1.16400797 -0.53968156 1.40925339]
[-0.35340998 -1.6993336 -1.47656266 -0.13971173]]]
bShape (1, 1, 1) biases [[[0.08176782]]]
m 2 n_H_prev 5 n_W_prev 7 n_C_prev 4

indexes i 0 h 0 w 0 c 2

Vertical index 0 : 3
Horizantal Index 0 : 3
a_slice shape (3, 3, 4)
a_slice_prev [[[ 1.62434536 -0.61175641 -0.52817175 -1.07296862]
[ 0.86540763 -2.3015387 1.74481176 -0.7612069 ]
[ 0.3190391 -0.24937038 1.46210794 -2.06014071]]

[[-0.26788808 0.53035547 -0.69166075 -0.39675353]
[-0.6871727 -0.84520564 -0.67124613 -0.0126646 ]
[-1.11731035 0.2344157 1.65980218 0.74204416]]

[[ 0.83898341 0.93110208 0.28558733 0.88514116]
[-0.75439794 1.25286816 0.51292982 -0.29809284]
[ 0.48851815 -0.07557171 1.13162939 1.51981682]]]
wshape (3, 3, 4) weights [[[ 0.09542509 -0.18657899 -0.95542526 0.01335268]
[ 3.03085711 0.28267571 0.43816635 -2.50644065]
[-0.16819884 -0.70134443 -1.94332341 0.02186284]]

[[-1.75592564 -0.11598519 -1.02188594 0.36723181]
[-0.28173627 0.31027229 -0.4791571 1.14690038]
[-1.1601701 -0.53223402 -0.625342 0.45015551]]

[[-0.4189379 -0.76730983 -0.10534471 -1.1077125 ]
[-0.56378873 0.69336623 0.12837699 1.62091229]
[-1.78791289 -0.27584606 -0.14319575 1.38631426]]]
bShape (1, 1, 1) biases [[[-0.45994283]]]
m 2 n_H_prev 5 n_W_prev 7 n_C_prev 4

indexes i 0 h 0 w 0 c 3

Vertical index 0 : 3
Horizantal Index 0 : 3
a_slice shape (3, 3, 4)
a_slice_prev [[[ 1.62434536 -0.61175641 -0.52817175 -1.07296862]
[ 0.86540763 -2.3015387 1.74481176 -0.7612069 ]
[ 0.3190391 -0.24937038 1.46210794 -2.06014071]]

[[-0.26788808 0.53035547 -0.69166075 -0.39675353]
[-0.6871727 -0.84520564 -0.67124613 -0.0126646 ]
[-1.11731035 0.2344157 1.65980218 0.74204416]]

[[ 0.83898341 0.93110208 0.28558733 0.88514116]
[-0.75439794 1.25286816 0.51292982 -0.29809284]
[ 0.48851815 -0.07557171 1.13162939 1.51981682]]]
wshape (3, 3, 4) weights [[[ 0.92145007 -0.05682448 0.58591043 -0.6946936 ]
[ 0.82458463 -0.82609743 1.12232832 -2.11416392]
[-0.17418034 -0.53722302 0.35249436 -0.46867382]]

[[ 0.7147896 -0.17545897 0.79452824 1.23289919]
[ 2.05635552 -2.09424782 0.35016716 -0.04970258]
[ 1.35010682 1.1181334 -0.59384307 1.7653351 ]]

[[-0.47918492 0.67457071 0.63019567 -0.01771832]
[ 0.08968641 -0.75806733 1.76041518 -0.80618482]
[ 0.36184732 1.22895559 1.03298378 0.54812958]]]
bShape (1, 1, 1) biases [[[0.64435367]]]
m 2 n_H_prev 5 n_W_prev 7 n_C_prev 4

indexes i 0 h 0 w 1 c 0

Vertical index 0 : 3
Horizantal Index 2 : 5
a_slice shape (3, 3, 4)
a_slice_prev [[[ 0.3190391 -0.24937038 1.46210794 -2.06014071]
[-0.3224172 -0.38405435 1.13376944 -1.09989127]
[-0.17242821 -0.87785842 0.04221375 0.58281521]]

[[-1.11731035 0.2344157 1.65980218 0.74204416]
[-0.19183555 -0.88762896 -0.74715829 1.6924546 ]
[ 0.05080775 -0.63699565 0.19091548 2.10025514]]

[[ 0.48851815 -0.07557171 1.13162939 1.51981682]
[ 2.18557541 -1.39649634 -1.44411381 -0.50446586]
[ 0.16003707 0.87616892 0.31563495 -2.02220122]]]
wshape (3, 3, 4) weights [[[-0.78191168 -1.11647002 0.417302 -0.27909772]
[ 1.3887794 -0.13597733 -0.23794194 -2.03720123]
[-0.10999149 -0.19505734 -0.55749472 0.58464661]]

[[ 2.13782807 0.61798553 -0.47537288 -1.30653407]
[ 0.45161595 -0.77785883 2.0546241 0.84086156]
[ 0.45128402 -0.38483225 -0.82246719 -0.0693287 ]]

[[-0.19899818 0.5154138 1.04008915 0.52887975]
[-0.25898285 0.16986926 1.44287693 0.63658341]
[ 0.68400133 -2.22711263 1.01120706 0.85328219]]]
bShape (1, 1, 1) biases [[[-1.39881282]]]
m 2 n_H_prev 5 n_W_prev 7 n_C_prev 4

indexes i 0 h 0 w 1 c 1

Vertical index 0 : 3
Horizantal Index 2 : 5
a_slice shape (3, 3, 4)
a_slice_prev [[[ 0.3190391 -0.24937038 1.46210794 -2.06014071]
[-0.3224172 -0.38405435 1.13376944 -1.09989127]
[-0.17242821 -0.87785842 0.04221375 0.58281521]]

[[-1.11731035 0.2344157 1.65980218 0.74204416]
[-0.19183555 -0.88762896 -0.74715829 1.6924546 ]
[ 0.05080775 -0.63699565 0.19091548 2.10025514]]

[[ 0.48851815 -0.07557171 1.13162939 1.51981682]
[ 2.18557541 -1.39649634 -1.44411381 -0.50446586]
[ 0.16003707 0.87616892 0.31563495 -2.02220122]]]
wshape (3, 3, 4) weights [[[-0.43750898 0.0809271 0.78477065 1.62284909]
[-0.66134424 -0.79726979 1.15528789 -1.94258918]
[ 0.00854895 0.80539342 0.93916874 0.32427424]]

[[-0.785534 -0.18417633 0.47761018 0.07638048]
[ 1.10417433 1.11584111 0.05340954 -0.10288722]
[-1.68405999 1.45810824 0.72171129 -0.10839207]]

[[ 1.86647138 -1.11487105 -0.91844004 -2.23708651]
[ 0.1892932 -1.16400797 -0.53968156 1.40925339]
[-0.35340998 -1.6993336 -1.47656266 -0.13971173]]]
bShape (1, 1, 1) biases [[[0.08176782]]]
m 2 n_H_prev 5 n_W_prev 7 n_C_prev 4

indexes i 0 h 0 w 1 c 2

Vertical index 0 : 3
Horizantal Index 2 : 5
a_slice shape (3, 3, 4)
a_slice_prev [[[ 0.3190391 -0.24937038 1.46210794 -2.06014071]
[-0.3224172 -0.38405435 1.13376944 -1.09989127]
[-0.17242821 -0.87785842 0.04221375 0.58281521]]

[[-1.11731035 0.2344157 1.65980218 0.74204416]
[-0.19183555 -0.88762896 -0.74715829 1.6924546 ]
[ 0.05080775 -0.63699565 0.19091548 2.10025514]]

[[ 0.48851815 -0.07557171 1.13162939 1.51981682]
[ 2.18557541 -1.39649634 -1.44411381 -0.50446586]
[ 0.16003707 0.87616892 0.31563495 -2.02220122]]]
wshape (3, 3, 4) weights [[[ 0.09542509 -0.18657899 -0.95542526 0.01335268]
[ 3.03085711 0.28267571 0.43816635 -2.50644065]
[-0.16819884 -0.70134443 -1.94332341 0.02186284]]

[[-1.75592564 -0.11598519 -1.02188594 0.36723181]
[-0.28173627 0.31027229 -0.4791571 1.14690038]
[-1.1601701 -0.53223402 -0.625342 0.45015551]]

[[-0.4189379 -0.76730983 -0.10534471 -1.1077125 ]
[-0.56378873 0.69336623 0.12837699 1.62091229]
[-1.78791289 -0.27584606 -0.14319575 1.38631426]]]
bShape (1, 1, 1) biases [[[-0.45994283]]]
m 2 n_H_prev 5 n_W_prev 7 n_C_prev 4

indexes i 0 h 0 w 1 c 3

Vertical index 0 : 3
Horizantal Index 2 : 5
a_slice shape (3, 3, 4)
a_slice_prev [[[ 0.3190391 -0.24937038 1.46210794 -2.06014071]
[-0.3224172 -0.38405435 1.13376944 -1.09989127]
[-0.17242821 -0.87785842 0.04221375 0.58281521]]

[[-1.11731035 0.2344157 1.65980218 0.74204416]
[-0.19183555 -0.88762896 -0.74715829 1.6924546 ]
[ 0.05080775 -0.63699565 0.19091548 2.10025514]]

[[ 0.48851815 -0.07557171 1.13162939 1.51981682]
[ 2.18557541 -1.39649634 -1.44411381 -0.50446586]
[ 0.16003707 0.87616892 0.31563495 -2.02220122]]]
wshape (3, 3, 4) weights [[[ 0.92145007 -0.05682448 0.58591043 -0.6946936 ]
[ 0.82458463 -0.82609743 1.12232832 -2.11416392]
[-0.17418034 -0.53722302 0.35249436 -0.46867382]]

[[ 0.7147896 -0.17545897 0.79452824 1.23289919]
[ 2.05635552 -2.09424782 0.35016716 -0.04970258]
[ 1.35010682 1.1181334 -0.59384307 1.7653351 ]]

[[-0.47918492 0.67457071 0.63019567 -0.01771832]
[ 0.08968641 -0.75806733 1.76041518 -0.80618482]
[ 0.36184732 1.22895559 1.03298378 0.54812958]]]
bShape (1, 1, 1) biases [[[0.64435367]]]
m 2 n_H_prev 5 n_W_prev 7 n_C_prev 4

indexes i 0 h 0 w 2 c 0

Vertical index 0 : 3
Horizantal Index 4 : 7
a_slice shape (3, 3, 4)
a_slice_prev [[[-0.17242821 -0.87785842 0.04221375 0.58281521]
[-1.10061918 1.14472371 0.90159072 0.50249434]
[ 0.90085595 -0.68372786 -0.12289023 -0.93576943]]

[[ 0.05080775 -0.63699565 0.19091548 2.10025514]
[ 0.12015895 0.61720311 0.30017032 -0.35224985]
[-1.1425182 -0.34934272 -0.20889423 0.58662319]]

[[ 0.16003707 0.87616892 0.31563495 -2.02220122]
[-0.30620401 0.82797464 0.23009474 0.76201118]
[-0.22232814 -0.20075807 0.18656139 0.41005165]]]
wshape (3, 3, 4) weights [[[-0.78191168 -1.11647002 0.417302 -0.27909772]
[ 1.3887794 -0.13597733 -0.23794194 -2.03720123]
[-0.10999149 -0.19505734 -0.55749472 0.58464661]]

[[ 2.13782807 0.61798553 -0.47537288 -1.30653407]
[ 0.45161595 -0.77785883 2.0546241 0.84086156]
[ 0.45128402 -0.38483225 -0.82246719 -0.0693287 ]]

[[-0.19899818 0.5154138 1.04008915 0.52887975]
[-0.25898285 0.16986926 1.44287693 0.63658341]
[ 0.68400133 -2.22711263 1.01120706 0.85328219]]]
bShape (1, 1, 1) biases [[[-1.39881282]]]
m 2 n_H_prev 5 n_W_prev 7 n_C_prev 4

indexes i 0 h 0 w 2 c 1

Vertical index 0 : 3
Horizantal Index 4 : 7
a_slice shape (3, 3, 4)
a_slice_prev [[[-0.17242821 -0.87785842 0.04221375 0.58281521]
[-1.10061918 1.14472371 0.90159072 0.50249434]
[ 0.90085595 -0.68372786 -0.12289023 -0.93576943]]

[[ 0.05080775 -0.63699565 0.19091548 2.10025514]
[ 0.12015895 0.61720311 0.30017032 -0.35224985]
[-1.1425182 -0.34934272 -0.20889423 0.58662319]]

[[ 0.16003707 0.87616892 0.31563495 -2.02220122]
[-0.30620401 0.82797464 0.23009474 0.76201118]
[-0.22232814 -0.20075807 0.18656139 0.41005165]]]
wshape (3, 3, 4) weights [[[-0.43750898 0.0809271 0.78477065 1.62284909]
[-0.66134424 -0.79726979 1.15528789 -1.94258918]
[ 0.00854895 0.80539342 0.93916874 0.32427424]]

[[-0.785534 -0.18417633 0.47761018 0.07638048]
[ 1.10417433 1.11584111 0.05340954 -0.10288722]
[-1.68405999 1.45810824 0.72171129 -0.10839207]]

[[ 1.86647138 -1.11487105 -0.91844004 -2.23708651]
[ 0.1892932 -1.16400797 -0.53968156 1.40925339]
[-0.35340998 -1.6993336 -1.47656266 -0.13971173]]]
bShape (1, 1, 1) biases [[[0.08176782]]]
m 2 n_H_prev 5 n_W_prev 7 n_C_prev 4

indexes i 0 h 0 w 2 c 2

Vertical index 0 : 3
Horizantal Index 4 : 7
a_slice shape (3, 3, 4)
a_slice_prev [[[-0.17242821 -0.87785842 0.04221375 0.58281521]
[-1.10061918 1.14472371 0.90159072 0.50249434]
[ 0.90085595 -0.68372786 -0.12289023 -0.93576943]]

[[ 0.05080775 -0.63699565 0.19091548 2.10025514]
[ 0.12015895 0.61720311 0.30017032 -0.35224985]
[-1.1425182 -0.34934272 -0.20889423 0.58662319]]

[[ 0.16003707 0.87616892 0.31563495 -2.02220122]
[-0.30620401 0.82797464 0.23009474 0.76201118]
[-0.22232814 -0.20075807 0.18656139 0.41005165]]]
wshape (3, 3, 4) weights [[[ 0.09542509 -0.18657899 -0.95542526 0.01335268]
[ 3.03085711 0.28267571 0.43816635 -2.50644065]
[-0.16819884 -0.70134443 -1.94332341 0.02186284]]

[[-1.75592564 -0.11598519 -1.02188594 0.36723181]
[-0.28173627 0.31027229 -0.4791571 1.14690038]
[-1.1601701 -0.53223402 -0.625342 0.45015551]]

[[-0.4189379 -0.76730983 -0.10534471 -1.1077125 ]
[-0.56378873 0.69336623 0.12837699 1.62091229]
[-1.78791289 -0.27584606 -0.14319575 1.38631426]]]
bShape (1, 1, 1) biases [[[-0.45994283]]]
m 2 n_H_prev 5 n_W_prev 7 n_C_prev 4

indexes i 0 h 0 w 2 c 3

Vertical index 0 : 3
Horizantal Index 4 : 7
a_slice shape (3, 3, 4)
a_slice_prev [[[-0.17242821 -0.87785842 0.04221375 0.58281521]
[-1.10061918 1.14472371 0.90159072 0.50249434]
[ 0.90085595 -0.68372786 -0.12289023 -0.93576943]]

[[ 0.05080775 -0.63699565 0.19091548 2.10025514]
[ 0.12015895 0.61720311 0.30017032 -0.35224985]
[-1.1425182 -0.34934272 -0.20889423 0.58662319]]

[[ 0.16003707 0.87616892 0.31563495 -2.02220122]
[-0.30620401 0.82797464 0.23009474 0.76201118]
[-0.22232814 -0.20075807 0.18656139 0.41005165]]]
wshape (3, 3, 4) weights [[[ 0.92145007 -0.05682448 0.58591043 -0.6946936 ]
[ 0.82458463 -0.82609743 1.12232832 -2.11416392]
[-0.17418034 -0.53722302 0.35249436 -0.46867382]]

[[ 0.7147896 -0.17545897 0.79452824 1.23289919]
[ 2.05635552 -2.09424782 0.35016716 -0.04970258]
[ 1.35010682 1.1181334 -0.59384307 1.7653351 ]]

[[-0.47918492 0.67457071 0.63019567 -0.01771832]
[ 0.08968641 -0.75806733 1.76041518 -0.80618482]
[ 0.36184732 1.22895559 1.03298378 0.54812958]]]
bShape (1, 1, 1) biases [[[0.64435367]]]
m 2 n_H_prev 5 n_W_prev 7 n_C_prev 4

indexes i 0 h 0 w 3 c 0

Vertical index 0 : 3
Horizantal Index 6 : 9
a_slice shape (3, 1, 4)
a_slice_prev [[[ 0.90085595 -0.68372786 -0.12289023 -0.93576943]]

[[-1.1425182 -0.34934272 -0.20889423 0.58662319]]

[[-0.22232814 -0.20075807 0.18656139 0.41005165]]]
wshape (3, 3, 4) weights [[[-0.78191168 -1.11647002 0.417302 -0.27909772]
[ 1.3887794 -0.13597733 -0.23794194 -2.03720123]
[-0.10999149 -0.19505734 -0.55749472 0.58464661]]

[[ 2.13782807 0.61798553 -0.47537288 -1.30653407]
[ 0.45161595 -0.77785883 2.0546241 0.84086156]
[ 0.45128402 -0.38483225 -0.82246719 -0.0693287 ]]

[[-0.19899818 0.5154138 1.04008915 0.52887975]
[-0.25898285 0.16986926 1.44287693 0.63658341]
[ 0.68400133 -2.22711263 1.01120706 0.85328219]]]
bShape (1, 1, 1) biases [[[-1.39881282]]]
m 2 n_H_prev 5 n_W_prev 7 n_C_prev 4

indexes i 0 h 0 w 3 c 1

Vertical index 0 : 3
Horizantal Index 6 : 9
a_slice shape (3, 1, 4)
a_slice_prev [[[ 0.90085595 -0.68372786 -0.12289023 -0.93576943]]

[[-1.1425182 -0.34934272 -0.20889423 0.58662319]]

[[-0.22232814 -0.20075807 0.18656139 0.41005165]]]
wshape (3, 3, 4) weights [[[-0.43750898 0.0809271 0.78477065 1.62284909]
[-0.66134424 -0.79726979 1.15528789 -1.94258918]
[ 0.00854895 0.80539342 0.93916874 0.32427424]]

[[-0.785534 -0.18417633 0.47761018 0.07638048]
[ 1.10417433 1.11584111 0.05340954 -0.10288722]
[-1.68405999 1.45810824 0.72171129 -0.10839207]]

[[ 1.86647138 -1.11487105 -0.91844004 -2.23708651]
[ 0.1892932 -1.16400797 -0.53968156 1.40925339]
[-0.35340998 -1.6993336 -1.47656266 -0.13971173]]]
bShape (1, 1, 1) biases [[[0.08176782]]]
m 2 n_H_prev 5 n_W_prev 7 n_C_prev 4

indexes i 0 h 0 w 3 c 2

Vertical index 0 : 3
Horizantal Index 6 : 9
a_slice shape (3, 1, 4)
a_slice_prev [[[ 0.90085595 -0.68372786 -0.12289023 -0.93576943]]

[[-1.1425182 -0.34934272 -0.20889423 0.58662319]]

[[-0.22232814 -0.20075807 0.18656139 0.41005165]]]
wshape (3, 3, 4) weights [[[ 0.09542509 -0.18657899 -0.95542526 0.01335268]
[ 3.03085711 0.28267571 0.43816635 -2.50644065]
[-0.16819884 -0.70134443 -1.94332341 0.02186284]]

[[-1.75592564 -0.11598519 -1.02188594 0.36723181]
[-0.28173627 0.31027229 -0.4791571 1.14690038]
[-1.1601701 -0.53223402 -0.625342 0.45015551]]

[[-0.4189379 -0.76730983 -0.10534471 -1.1077125 ]
[-0.56378873 0.69336623 0.12837699 1.62091229]
[-1.78791289 -0.27584606 -0.14319575 1.38631426]]]
bShape (1, 1, 1) biases [[[-0.45994283]]]
m 2 n_H_prev 5 n_W_prev 7 n_C_prev 4

indexes i 0 h 0 w 3 c 3

Vertical index 0 : 3
Horizantal Index 6 : 9
a_slice shape (3, 1, 4)
a_slice_prev [[[ 0.90085595 -0.68372786 -0.12289023 -0.93576943]]

[[-1.1425182 -0.34934272 -0.20889423 0.58662319]]

[[-0.22232814 -0.20075807 0.18656139 0.41005165]]]
wshape (3, 3, 4) weights [[[ 0.92145007 -0.05682448 0.58591043 -0.6946936 ]
[ 0.82458463 -0.82609743 1.12232832 -2.11416392]
[-0.17418034 -0.53722302 0.35249436 -0.46867382]]

[[ 0.7147896 -0.17545897 0.79452824 1.23289919]
[ 2.05635552 -2.09424782 0.35016716 -0.04970258]
[ 1.35010682 1.1181334 -0.59384307 1.7653351 ]]

[[-0.47918492 0.67457071 0.63019567 -0.01771832]
[ 0.08968641 -0.75806733 1.76041518 -0.80618482]
[ 0.36184732 1.22895559 1.03298378 0.54812958]]]
bShape (1, 1, 1) biases [[[0.64435367]]]
m 2 n_H_prev 5 n_W_prev 7 n_C_prev 4

indexes i 0 h 0 w 4 c 0

Vertical index 0 : 3
Horizantal Index 8 : 11
a_slice shape (3, 0, 4)
a_slice_prev
wshape (3, 3, 4) weights [[[-0.78191168 -1.11647002 0.417302 -0.27909772]
[ 1.3887794 -0.13597733 -0.23794194 -2.03720123]
[-0.10999149 -0.19505734 -0.55749472 0.58464661]]

[[ 2.13782807 0.61798553 -0.47537288 -1.30653407]
[ 0.45161595 -0.77785883 2.0546241 0.84086156]
[ 0.45128402 -0.38483225 -0.82246719 -0.0693287 ]]

[[-0.19899818 0.5154138 1.04008915 0.52887975]
[-0.25898285 0.16986926 1.44287693 0.63658341]
[ 0.68400133 -2.22711263 1.01120706 0.85328219]]]
bShape (1, 1, 1) biases [[[-1.39881282]]]

ValueError Traceback (most recent call last)
in
6 “stride”: 2}
7
----> 8 Z, cache_conv = conv_forward(A_prev, W, b, hparameters)
9 z_mean = np.mean(Z)
10 z_0_2_1 = Z[0, 2, 1]

in conv_forward(A_prev, W, b, hparameters)
95 print(“wshape”,weights.shape,“weights”,weights)
96 print(“bShape”,biases.shape,“biases”,biases)
—> 97 Z[i, h, w, c] = conv_single_step(a_slice_prev, weights, biases)
98
99

in conv_single_step(a_slice_prev, W, b)
23 # Z = None
24 # YOUR CODE STARTS HERE
—> 25 s = np.multiply(a_slice_prev,W)
26 Z = np.sum(s)
27 Z += float(b)

ValueError: operands could not be broadcast together with shapes (3,0,4) (3,3,4)

1 Like

@rws7349 oh goodness, you’ve posted like everything. But you should be able to only do ‘print(xyz.shape)’ and that should be sufficient.

Also, I don’t have an exercise three for week one of course four… So I am not sure where you are getting this from (!).

1 Like

@rws7349 my bad, you are talking about ‘within’ the assignment.

What I came up with looks similar, but I guess I can sneak I don’t have the ‘+=’… Yet I don’t see why that shouldn’t work.

1 Like

That’s an unreadable amount of data.

Convolutional Neural Networks
week 1
Convolutional Neural Networks: Step by Step lab (first lab assignment)
Exercise 3 - conv_forward

1 Like

Sorry… trying to understand the indexes and the matrixes…

1 Like

Got rid of all the debug print statements… I do use stride in the calculation of the horizontal and vertical indexes…
thanks,.

rick


Z's mean =
 1.0644642603114827
Z[0,2,1] =
 [-5.42280893  1.88549165 -4.09974126 -3.48941271 -5.34564475  3.56732833
  1.77640635 -2.33586583]
cache_conv[0][1][2][3] =
 [-1.1191154   1.9560789  -0.3264995  -1.34267579]
First Test: Z's mean is incorrect. Expected: 0.5511276474566768 
Your output: 1.0644642603114827 . Make sure you include stride in your calculation

First Test: Z[0,2,1] is incorrect. Expected: [-2.17796037, 8.07171329, -0.5772704, 3.36286738, 4.48113645, -2.89198428, 10.99288867, 3.03171932] 
Your output: [-5.42280893  1.88549165 -4.09974126 -3.48941271 -5.34564475  3.56732833
  1.77640635 -2.33586583] Make sure you include stride in your calculation

1 Like

@rws7349 I am calling it a night. But don’t feel bad. I just think we were like ‘holy moly’.

1 Like

The best place to start is by reading this thread, which gives a good description of the steps in this algorithm.

Also note that you put this thread in the category of DLS Course 1. I’ll move it to Course 4 for you by using the little “edit pencil” on the title.

2 Likes

Thanks… I’ve gone through the pseudo code multiple times… it looks right… I changed the single step function… even though it passed all the tests… Looked at the indexes… they look right… I noticed that the shape of the a_slice_prev at vert 0:3 Horiz 6:9… I don’t think that should happen…

thanks,

rick

Z 1.2662814823774746 a_slice_prev.shape (3, 3, 4) vert 0 : 3 Horiz 0 : 3
Z -2.1535969723867434 a_slice_prev.shape (3, 3, 4) vert 0 : 3 Horiz 0 : 3
Z 3.7476684630890014 a_slice_prev.shape (3, 3, 4) vert 0 : 3 Horiz 0 : 3
Z 10.832961684356558 a_slice_prev.shape (3, 3, 4) vert 0 : 3 Horiz 0 : 3
Z -10.517742656525416 a_slice_prev.shape (3, 3, 4) vert 0 : 3 Horiz 0 : 3
Z 5.062288612330711 a_slice_prev.shape (3, 3, 4) vert 0 : 3 Horiz 0 : 3
Z 5.221445301005137 a_slice_prev.shape (3, 3, 4) vert 0 : 3 Horiz 0 : 3
Z -5.1214563664734065 a_slice_prev.shape (3, 3, 4) vert 0 : 3 Horiz 0 : 3
Z -6.258617871109428 a_slice_prev.shape (3, 3, 4) vert 0 : 3 Horiz 2 : 5
Z -2.689000474036028 a_slice_prev.shape (3, 3, 4) vert 0 : 3 Horiz 2 : 5
Z -3.8986335715420135 a_slice_prev.shape (3, 3, 4) vert 0 : 3 Horiz 2 : 5
Z 12.468644252240049 a_slice_prev.shape (3, 3, 4) vert 0 : 3 Horiz 2 : 5
Z -2.7630811248670852 a_slice_prev.shape (3, 3, 4) vert 0 : 3 Horiz 2 : 5
Z -8.832668252343877 a_slice_prev.shape (3, 3, 4) vert 0 : 3 Horiz 2 : 5
Z -0.4809298066907338 a_slice_prev.shape (3, 3, 4) vert 0 : 3 Horiz 2 : 5
Z 2.476240959420655 a_slice_prev.shape (3, 3, 4) vert 0 : 3 Horiz 2 : 5
Z -5.721635618125335 a_slice_prev.shape (3, 3, 4) vert 0 : 3 Horiz 4 : 7
Z 5.957742976188665 a_slice_prev.shape (3, 3, 4) vert 0 : 3 Horiz 4 : 7
Z 2.8748457352455863 a_slice_prev.shape (3, 3, 4) vert 0 : 3 Horiz 4 : 7
Z 0.02500588643278301 a_slice_prev.shape (3, 3, 4) vert 0 : 3 Horiz 4 : 7
Z 1.8089142892819994 a_slice_prev.shape (3, 3, 4) vert 0 : 3 Horiz 4 : 7
Z 7.343640984885067 a_slice_prev.shape (3, 3, 4) vert 0 : 3 Horiz 4 : 7
Z 0.4931962367013002 a_slice_prev.shape (3, 3, 4) vert 0 : 3 Horiz 4 : 7
Z 1.745844216321027 a_slice_prev.shape (3, 3, 4) vert 0 : 3 Horiz 4 : 7
Z -0.3113816826849003 a_slice_prev.shape (3, 1, 4) vert 0 : 3 Horiz 6 : 9 <----- shape change
Z -1.459118803567828 a_slice_prev.shape (3, 1, 4) vert 0 : 3 Horiz 6 : 9
Z 12.044389447401334 a_slice_prev.shape (3, 1, 4) vert 0 : 3 Horiz 6 : 9
Z 3.4552426871473454 a_slice_prev.shape (3, 1, 4) vert 0 : 3 Horiz 6 : 9
Z -3.1241750429206725 a_slice_prev.shape (3, 1, 4) vert 0 : 3 Horiz 6 : 9
Z 3.309603521725634 a_slice_prev.shape (3, 1, 4) vert 0 : 3 Horiz 6 : 9
Z 2.9472820959263624 a_slice_prev.shape (3, 1, 4) vert 0 : 3 Horiz 6 : 9
Z 0.21736142252595975 a_slice_prev.shape (3, 1, 4) vert 0 : 3 Horiz 6 : 9
Z 3.4539853581889997 a_slice_prev.shape (3, 3, 4) vert 2 : 5 Horiz 0 : 3
Z 10.755992709290462 a_slice_prev.shape (3, 3, 4) vert 2 : 5 Horiz 0 : 3
Z 1.2236595127479615 a_slice_prev.shape (3, 3, 4) vert 2 : 5 Horiz 0 : 3
Z 0.6785270863131011 a_slice_prev.shape (3, 3, 4) vert 2 : 5 Horiz 0 : 3
Z 0.9981441046534135 a_slice_prev.shape (3, 3, 4) vert 2 : 5 Horiz 0 : 3
Z 10.580161416427249 a_slice_prev.shape (3, 3, 4) vert 2 : 5 Horiz 0 : 3
Z 6.194580476073165 a_slice_prev.shape (3, 3, 4) vert 2 : 5 Horiz 0 : 3
Z -2.9728973560088656 a_slice_prev.shape (3, 3, 4) vert 2 : 5 Horiz 0 : 3
Z -0.2360877458228292 a_slice_prev.shape (3, 3, 4) vert 2 : 5 Horiz 2 : 5
Z -2.142946465657931 a_slice_prev.shape (3, 3, 4) vert 2 : 5 Horiz 2 : 5
Z 7.568707543448689 a_slice_prev.shape (3, 3, 4) vert 2 : 5 Horiz 2 : 5
Z 6.322270954784464 a_slice_prev.shape (3, 3, 4) vert 2 : 5 Horiz 2 : 5
Z 4.049873906441557 a_slice_prev.shape (3, 3, 4) vert 2 : 5 Horiz 2 : 5
Z -3.324142725358976 a_slice_prev.shape (3, 3, 4) vert 2 : 5 Horiz 2 : 5
Z -4.709821189153913 a_slice_prev.shape (3, 3, 4) vert 2 : 5 Horiz 2 : 5
Z -11.274799752787887 a_slice_prev.shape (3, 3, 4) vert 2 : 5 Horiz 2 : 5
Z 1.2404061101329424 a_slice_prev.shape (3, 3, 4) vert 2 : 5 Horiz 4 : 7
Z -8.82048824659804 a_slice_prev.shape (3, 3, 4) vert 2 : 5 Horiz 4 : 7
Z -2.9330921483288463 a_slice_prev.shape (3, 3, 4) vert 2 : 5 Horiz 4 : 7
Z 1.3902093296499074 a_slice_prev.shape (3, 3, 4) vert 2 : 5 Horiz 4 : 7
Z 0.035652335955390024 a_slice_prev.shape (3, 3, 4) vert 2 : 5 Horiz 4 : 7
Z 8.269684131999805 a_slice_prev.shape (3, 3, 4) vert 2 : 5 Horiz 4 : 7
Z -3.469393652073488 a_slice_prev.shape (3, 3, 4) vert 2 : 5 Horiz 4 : 7
Z 8.20083050109453 a_slice_prev.shape (3, 3, 4) vert 2 : 5 Horiz 4 : 7
Z 0.7435653267019693 a_slice_prev.shape (3, 1, 4) vert 2 : 5 Horiz 6 : 9
Z 2.5644614267226387 a_slice_prev.shape (3, 1, 4) vert 2 : 5 Horiz 6 : 9
Z 0.8607109306058083 a_slice_prev.shape (3, 1, 4) vert 2 : 5 Horiz 6 : 9
Z 0.0658633223102244 a_slice_prev.shape (3, 1, 4) vert 2 : 5 Horiz 6 : 9
Z -0.5668516295715759 a_slice_prev.shape (3, 1, 4) vert 2 : 5 Horiz 6 : 9
Z 4.321222056060618 a_slice_prev.shape (3, 1, 4) vert 2 : 5 Horiz 6 : 9
Z -2.4074110198687206 a_slice_prev.shape (3, 1, 4) vert 2 : 5 Horiz 6 : 9
Z -6.663237035364183 a_slice_prev.shape (3, 1, 4) vert 2 : 5 Horiz 6 : 9
Z 10.237018550092838 a_slice_prev.shape (1, 3, 4) vert 4 : 7 Horiz 0 : 3
Z 4.328495147802618 a_slice_prev.shape (1, 3, 4) vert 4 : 7 Horiz 0 : 3
Z -1.5858171275168909 a_slice_prev.shape (1, 3, 4) vert 4 : 7 Horiz 0 : 3
Z 12.701010286622248 a_slice_prev.shape (1, 3, 4) vert 4 : 7 Horiz 0 : 3
Z -1.462106940267271 a_slice_prev.shape (1, 3, 4) vert 4 : 7 Horiz 0 : 3
Z 7.344240316771664 a_slice_prev.shape (1, 3, 4) vert 4 : 7 Horiz 0 : 3
Z 13.985063553920376 a_slice_prev.shape (1, 3, 4) vert 4 : 7 Horiz 0 : 3
Z -2.5384787430653852 a_slice_prev.shape (1, 3, 4) vert 4 : 7 Horiz 0 : 3
Z -5.422808930632951 a_slice_prev.shape (1, 3, 4) vert 4 : 7 Horiz 2 : 5
Z 1.8854916456453084 a_slice_prev.shape (1, 3, 4) vert 4 : 7 Horiz 2 : 5
Z -4.09974126396935 a_slice_prev.shape (1, 3, 4) vert 4 : 7 Horiz 2 : 5
Z -3.4894127074748154 a_slice_prev.shape (1, 3, 4) vert 4 : 7 Horiz 2 : 5
Z -5.345644754463232 a_slice_prev.shape (1, 3, 4) vert 4 : 7 Horiz 2 : 5
Z 3.5673283316428654 a_slice_prev.shape (1, 3, 4) vert 4 : 7 Horiz 2 : 5
Z 1.7764063479558851 a_slice_prev.shape (1, 3, 4) vert 4 : 7 Horiz 2 : 5
Z -2.335865829434046 a_slice_prev.shape (1, 3, 4) vert 4 : 7 Horiz 2 : 5
Z 1.781244821962844 a_slice_prev.shape (1, 3, 4) vert 4 : 7 Horiz 4 : 7
Z -3.3452898485053537 a_slice_prev.shape (1, 3, 4) vert 4 : 7 Horiz 4 : 7
Z -2.1304654320635255 a_slice_prev.shape (1, 3, 4) vert 4 : 7 Horiz 4 : 7
Z -2.8535590604172163 a_slice_prev.shape (1, 3, 4) vert 4 : 7 Horiz 4 : 7
Z -2.134749405340585 a_slice_prev.shape (1, 3, 4) vert 4 : 7 Horiz 4 : 7
Z 5.307458163486336 a_slice_prev.shape (1, 3, 4) vert 4 : 7 Horiz 4 : 7
Z 6.507316293551165 a_slice_prev.shape (1, 3, 4) vert 4 : 7 Horiz 4 : 7
Z 11.176217604916287 a_slice_prev.shape (1, 3, 4) vert 4 : 7 Horiz 4 : 7
Z 7.698510135686714 a_slice_prev.shape (1, 1, 4) vert 4 : 7 Horiz 6 : 9
Z 2.3143150141779065 a_slice_prev.shape (1, 1, 4) vert 4 : 7 Horiz 6 : 9
Z -4.25708049953426 a_slice_prev.shape (1, 1, 4) vert 4 : 7 Horiz 6 : 9
Z 10.036996221973089 a_slice_prev.shape (1, 1, 4) vert 4 : 7 Horiz 6 : 9
Z -3.4258250548142013 a_slice_prev.shape (1, 1, 4) vert 4 : 7 Horiz 6 : 9
Z 1.4585541045224582 a_slice_prev.shape (1, 1, 4) vert 4 : 7 Horiz 6 : 9
Z 0.7908789056918231 a_slice_prev.shape (1, 1, 4) vert 4 : 7 Horiz 6 : 9
Z -2.756601472028101 a_slice_prev.shape (1, 1, 4) vert 4 : 7 Horiz 6 : 9
Z 3.8434068513071384 a_slice_prev.shape (3, 3, 4) vert 0 : 3 Horiz 0 : 3
Z 4.369137602627774 a_slice_prev.shape (3, 3, 4) vert 0 : 3 Horiz 0 : 3
Z -2.8395394454490197 a_slice_prev.shape (3, 3, 4) vert 0 : 3 Horiz 0 : 3
Z 1.365745706992863 a_slice_prev.shape (3, 3, 4) vert 0 : 3 Horiz 0 : 3
Z 4.536005045669974 a_slice_prev.shape (3, 3, 4) vert 0 : 3 Horiz 0 : 3
Z -1.143915353688104 a_slice_prev.shape (3, 3, 4) vert 0 : 3 Horiz 0 : 3
Z -14.684820177283612 a_slice_prev.shape (3, 3, 4) vert 0 : 3 Horiz 0 : 3
Z -9.66045615323045 a_slice_prev.shape (3, 3, 4) vert 0 : 3 Horiz 0 : 3
Z 0.6297419164085203 a_slice_prev.shape (3, 3, 4) vert 0 : 3 Horiz 2 : 5
Z -7.431018003214487 a_slice_prev.shape (3, 3, 4) vert 0 : 3 Horiz 2 : 5
Z 5.150977992092285 a_slice_prev.shape (3, 3, 4) vert 0 : 3 Horiz 2 : 5
Z -3.820319936199402 a_slice_prev.shape (3, 3, 4) vert 0 : 3 Horiz 2 : 5
Z -3.6779888232749958 a_slice_prev.shape (3, 3, 4) vert 0 : 3 Horiz 2 : 5
Z 9.35671637233627 a_slice_prev.shape (3, 3, 4) vert 0 : 3 Horiz 2 : 5
Z -3.2826254818133536 a_slice_prev.shape (3, 3, 4) vert 0 : 3 Horiz 2 : 5
Z 10.689306369240096 a_slice_prev.shape (3, 3, 4) vert 0 : 3 Horiz 2 : 5
Z 2.5462258232712225 a_slice_prev.shape (3, 3, 4) vert 0 : 3 Horiz 4 : 7
Z -0.7968830194278302 a_slice_prev.shape (3, 3, 4) vert 0 : 3 Horiz 4 : 7
Z -11.97363739979244 a_slice_prev.shape (3, 3, 4) vert 0 : 3 Horiz 4 : 7
Z 9.222767885568816 a_slice_prev.shape (3, 3, 4) vert 0 : 3 Horiz 4 : 7
Z -6.0605786964468145 a_slice_prev.shape (3, 3, 4) vert 0 : 3 Horiz 4 : 7
Z 1.7148248407881723 a_slice_prev.shape (3, 3, 4) vert 0 : 3 Horiz 4 : 7
Z 2.438868431441386 a_slice_prev.shape (3, 3, 4) vert 0 : 3 Horiz 4 : 7
Z -0.7155081801333465 a_slice_prev.shape (3, 3, 4) vert 0 : 3 Horiz 4 : 7
Z 10.171101103439327 a_slice_prev.shape (3, 1, 4) vert 0 : 3 Horiz 6 : 9
Z -0.46104544617147436 a_slice_prev.shape (3, 1, 4) vert 0 : 3 Horiz 6 : 9
Z -17.54372211902188 a_slice_prev.shape (3, 1, 4) vert 0 : 3 Horiz 6 : 9
Z 10.975874085981127 a_slice_prev.shape (3, 1, 4) vert 0 : 3 Horiz 6 : 9
Z -1.0648867386872896 a_slice_prev.shape (3, 1, 4) vert 0 : 3 Horiz 6 : 9
Z 2.343325731239089 a_slice_prev.shape (3, 1, 4) vert 0 : 3 Horiz 6 : 9
Z -5.686354195515615 a_slice_prev.shape (3, 1, 4) vert 0 : 3 Horiz 6 : 9
Z -4.657296737023627 a_slice_prev.shape (3, 1, 4) vert 0 : 3 Horiz 6 : 9
Z -1.051729710849143 a_slice_prev.shape (3, 3, 4) vert 2 : 5 Horiz 0 : 3
Z -10.474208508432586 a_slice_prev.shape (3, 3, 4) vert 2 : 5 Horiz 0 : 3
Z -3.6105265160707707 a_slice_prev.shape (3, 3, 4) vert 2 : 5 Horiz 0 : 3
Z -3.3059140978542207 a_slice_prev.shape (3, 3, 4) vert 2 : 5 Horiz 0 : 3
Z 5.515213595771725 a_slice_prev.shape (3, 3, 4) vert 2 : 5 Horiz 0 : 3
Z 10.051582256286869 a_slice_prev.shape (3, 3, 4) vert 2 : 5 Horiz 0 : 3
Z 1.7837768259049014 a_slice_prev.shape (3, 3, 4) vert 2 : 5 Horiz 0 : 3
Z 20.438589576316943 a_slice_prev.shape (3, 3, 4) vert 2 : 5 Horiz 0 : 3
Z 9.327709628767343 a_slice_prev.shape (3, 3, 4) vert 2 : 5 Horiz 2 : 5
Z -4.288205706177817 a_slice_prev.shape (3, 3, 4) vert 2 : 5 Horiz 2 : 5
Z 9.034243482620758 a_slice_prev.shape (3, 3, 4) vert 2 : 5 Horiz 2 : 5
Z -8.503955927963942 a_slice_prev.shape (3, 3, 4) vert 2 : 5 Horiz 2 : 5
Z -11.670097817575723 a_slice_prev.shape (3, 3, 4) vert 2 : 5 Horiz 2 : 5
Z 11.997751704917711 a_slice_prev.shape (3, 3, 4) vert 2 : 5 Horiz 2 : 5
Z 0.3393340610159792 a_slice_prev.shape (3, 3, 4) vert 2 : 5 Horiz 2 : 5
Z 15.928226672417525 a_slice_prev.shape (3, 3, 4) vert 2 : 5 Horiz 2 : 5
Z -4.362010270511885 a_slice_prev.shape (3, 3, 4) vert 2 : 5 Horiz 4 : 7
Z -7.657693687839465 a_slice_prev.shape (3, 3, 4) vert 2 : 5 Horiz 4 : 7
Z -0.36017734167610865 a_slice_prev.shape (3, 3, 4) vert 2 : 5 Horiz 4 : 7
Z -1.7681750616968457 a_slice_prev.shape (3, 3, 4) vert 2 : 5 Horiz 4 : 7
Z -12.022168504033887 a_slice_prev.shape (3, 3, 4) vert 2 : 5 Horiz 4 : 7
Z 9.38928498331993 a_slice_prev.shape (3, 3, 4) vert 2 : 5 Horiz 4 : 7
Z 9.782673242617188 a_slice_prev.shape (3, 3, 4) vert 2 : 5 Horiz 4 : 7
Z -2.065366459834221 a_slice_prev.shape (3, 3, 4) vert 2 : 5 Horiz 4 : 7
Z 3.689193594615835 a_slice_prev.shape (3, 1, 4) vert 2 : 5 Horiz 6 : 9
Z -11.104866204153712 a_slice_prev.shape (3, 1, 4) vert 2 : 5 Horiz 6 : 9
Z 1.0952229526080357 a_slice_prev.shape (3, 1, 4) vert 2 : 5 Horiz 6 : 9
Z 13.615433533529144 a_slice_prev.shape (3, 1, 4) vert 2 : 5 Horiz 6 : 9
Z 11.215377976296464 a_slice_prev.shape (3, 1, 4) vert 2 : 5 Horiz 6 : 9
Z 6.9322552444856065 a_slice_prev.shape (3, 1, 4) vert 2 : 5 Horiz 6 : 9
Z -6.0440035575296 a_slice_prev.shape (3, 1, 4) vert 2 : 5 Horiz 6 : 9
Z -9.10809356821251 a_slice_prev.shape (3, 1, 4) vert 2 : 5 Horiz 6 : 9
Z 4.999980707460569 a_slice_prev.shape (1, 3, 4) vert 4 : 7 Horiz 0 : 3
Z -2.870930452638695 a_slice_prev.shape (1, 3, 4) vert 4 : 7 Horiz 0 : 3
Z 7.506571292447728 a_slice_prev.shape (1, 3, 4) vert 4 : 7 Horiz 0 : 3
Z 2.9334896132474775 a_slice_prev.shape (1, 3, 4) vert 4 : 7 Horiz 0 : 3
Z 6.376848615879241 a_slice_prev.shape (1, 3, 4) vert 4 : 7 Horiz 0 : 3
Z 8.308956194538943 a_slice_prev.shape (1, 3, 4) vert 4 : 7 Horiz 0 : 3
Z 0.15340278893506404 a_slice_prev.shape (1, 3, 4) vert 4 : 7 Horiz 0 : 3
Z 8.533009707071573 a_slice_prev.shape (1, 3, 4) vert 4 : 7 Horiz 0 : 3
Z 4.119348743279627 a_slice_prev.shape (1, 3, 4) vert 4 : 7 Horiz 2 : 5
Z 0.8723646261429236 a_slice_prev.shape (1, 3, 4) vert 4 : 7 Horiz 2 : 5
Z 2.346717077703915 a_slice_prev.shape (1, 3, 4) vert 4 : 7 Horiz 2 : 5
Z 0.22071895243239315 a_slice_prev.shape (1, 3, 4) vert 4 : 7 Horiz 2 : 5
Z -3.4022179609679175 a_slice_prev.shape (1, 3, 4) vert 4 : 7 Horiz 2 : 5
Z 14.130801119634963 a_slice_prev.shape (1, 3, 4) vert 4 : 7 Horiz 2 : 5
Z 3.9921481286640867 a_slice_prev.shape (1, 3, 4) vert 4 : 7 Horiz 2 : 5
Z 0.5654928097908489 a_slice_prev.shape (1, 3, 4) vert 4 : 7 Horiz 2 : 5
Z -6.660177073340824 a_slice_prev.shape (1, 3, 4) vert 4 : 7 Horiz 4 : 7
Z 3.985431822952647 a_slice_prev.shape (1, 3, 4) vert 4 : 7 Horiz 4 : 7
Z 5.300166794605861 a_slice_prev.shape (1, 3, 4) vert 4 : 7 Horiz 4 : 7
Z 4.260101860404679 a_slice_prev.shape (1, 3, 4) vert 4 : 7 Horiz 4 : 7
Z 1.382178372690623 a_slice_prev.shape (1, 3, 4) vert 4 : 7 Horiz 4 : 7
Z 5.403299489674435 a_slice_prev.shape (1, 3, 4) vert 4 : 7 Horiz 4 : 7
Z -3.2152790491292826 a_slice_prev.shape (1, 3, 4) vert 4 : 7 Horiz 4 : 7
Z -11.689492214947819 a_slice_prev.shape (1, 3, 4) vert 4 : 7 Horiz 4 : 7
Z -12.50798691302913 a_slice_prev.shape (1, 1, 4) vert 4 : 7 Horiz 6 : 9
Z -2.5215718179809725 a_slice_prev.shape (1, 1, 4) vert 4 : 7 Horiz 6 : 9
Z 5.430217282664337 a_slice_prev.shape (1, 1, 4) vert 4 : 7 Horiz 6 : 9
Z -11.656986559875639 a_slice_prev.shape (1, 1, 4) vert 4 : 7 Horiz 6 : 9
Z 1.0414383935249782 a_slice_prev.shape (1, 1, 4) vert 4 : 7 Horiz 6 : 9
Z 12.670660683131844 a_slice_prev.shape (1, 1, 4) vert 4 : 7 Horiz 6 : 9
Z 6.44876932768129 a_slice_prev.shape (1, 1, 4) vert 4 : 7 Horiz 6 : 9
Z 5.650559412813017 a_slice_prev.shape (1, 1, 4) vert 4 : 7 Horiz 6 : 9
Z’s mean =
1.0644642603114827
Z[0,2,1] =
[-5.42280893 1.88549165 -4.09974126 -3.48941271 -5.34564475 3.56732833
1.77640635 -2.33586583]
cache_conv[0][1][2][3] =
[-1.1191154 1.9560789 -0.3264995 -1.34267579]
First Test: Z’s mean is incorrect. Expected: 0.5511276474566768
Your output: 1.0644642603114827 . Make sure you include stride in your calculation

First Test: Z[0,2,1] is incorrect. Expected: [-2.17796037, 8.07171329, -0.5772704, 3.36286738, 4.48113645, -2.89198428, 10.99288867, 3.03171932]
Your output: [-5.42280893 1.88549165 -4.09974126 -3.48941271 -5.34564475 3.56732833
1.77640635 -2.33586583] Make sure you include stride in your calculation

Z 8.430161780192094 a_slice_prev.shape (3, 3, 4) vert 0 : 3 Horiz 0 : 3
Z -1.3955354672738824 a_slice_prev.shape (3, 3, 4) vert 0 : 3 Horiz 0 : 3
Z -0.02618143066850498 a_slice_prev.shape (3, 3, 4) vert 0 : 3 Horiz 0 : 3
Z 3.43570856283666 a_slice_prev.shape (3, 3, 4) vert 0 : 3 Horiz 0 : 3
Z 9.876524567680953 a_slice_prev.shape (3, 3, 4) vert 0 : 3 Horiz 0 : 3
Z 8.31646307886973 a_slice_prev.shape (3, 3, 4) vert 0 : 3 Horiz 0 : 3
Z -5.030772164600701 a_slice_prev.shape (3, 3, 4) vert 0 : 3 Horiz 0 : 3
Z -15.261246745762584 a_slice_prev.shape (3, 3, 4) vert 0 : 3 Horiz 0 : 3
Z 1.990380216656388 a_slice_prev.shape (3, 3, 4) vert 0 : 3 Horiz 1 : 4
Z -2.381959261430733 a_slice_prev.shape (3, 3, 4) vert 0 : 3 Horiz 1 : 4
Z -3.794313847229871 a_slice_prev.shape (3, 3, 4) vert 0 : 3 Horiz 1 : 4
Z -1.5844582815290336 a_slice_prev.shape (3, 3, 4) vert 0 : 3 Horiz 1 : 4
Z 1.7196751783665472 a_slice_prev.shape (3, 3, 4) vert 0 : 3 Horiz 1 : 4
Z -14.604296522924328 a_slice_prev.shape (3, 3, 4) vert 0 : 3 Horiz 1 : 4
Z 2.0822708112059884 a_slice_prev.shape (3, 3, 4) vert 0 : 3 Horiz 1 : 4
Z 4.214643154626296 a_slice_prev.shape (3, 3, 4) vert 0 : 3 Horiz 1 : 4
Z -2.3286630155361734 a_slice_prev.shape (3, 3, 4) vert 0 : 3 Horiz 2 : 5
Z 5.38874963597861 a_slice_prev.shape (3, 3, 4) vert 0 : 3 Horiz 2 : 5
Z -1.224736342644098 a_slice_prev.shape (3, 3, 4) vert 0 : 3 Horiz 2 : 5
Z 7.984668402917872 a_slice_prev.shape (3, 3, 4) vert 0 : 3 Horiz 2 : 5
Z 6.447544997277389 a_slice_prev.shape (3, 3, 4) vert 0 : 3 Horiz 2 : 5
Z -2.8178754238397477 a_slice_prev.shape (3, 3, 4) vert 0 : 3 Horiz 2 : 5
Z -6.267758270519971 a_slice_prev.shape (3, 3, 4) vert 0 : 3 Horiz 2 : 5
Z -13.007823064582594 a_slice_prev.shape (3, 3, 4) vert 0 : 3 Horiz 2 : 5
Z -7.232481261921993 a_slice_prev.shape (3, 3, 4) vert 0 : 3 Horiz 3 : 6
Z 4.893156110378545 a_slice_prev.shape (3, 3, 4) vert 0 : 3 Horiz 3 : 6
Z 0.9267758070700746 a_slice_prev.shape (3, 3, 4) vert 0 : 3 Horiz 3 : 6
Z 4.785125744390734 a_slice_prev.shape (3, 3, 4) vert 0 : 3 Horiz 3 : 6
Z 3.8659142301836376 a_slice_prev.shape (3, 3, 4) vert 0 : 3 Horiz 3 : 6
Z 3.1823336081548774 a_slice_prev.shape (3, 3, 4) vert 0 : 3 Horiz 3 : 6
Z -3.3591106051099926 a_slice_prev.shape (3, 3, 4) vert 0 : 3 Horiz 3 : 6
Z -14.58968724805581 a_slice_prev.shape (3, 3, 4) vert 0 : 3 Horiz 3 : 6
Z 4.797951348424293 a_slice_prev.shape (3, 3, 4) vert 0 : 3 Horiz 4 : 7
Z 0.2835908051249756 a_slice_prev.shape (3, 3, 4) vert 0 : 3 Horiz 4 : 7
Z -0.9441011600808382 a_slice_prev.shape (3, 3, 4) vert 0 : 3 Horiz 4 : 7
Z 5.455933334336547 a_slice_prev.shape (3, 3, 4) vert 0 : 3 Horiz 4 : 7
Z 4.057864355949645 a_slice_prev.shape (3, 3, 4) vert 0 : 3 Horiz 4 : 7
Z -0.1389119750259682 a_slice_prev.shape (3, 3, 4) vert 0 : 3 Horiz 4 : 7
Z 3.4620730197923297 a_slice_prev.shape (3, 3, 4) vert 0 : 3 Horiz 4 : 7
Z 2.9413079855463096 a_slice_prev.shape (3, 3, 4) vert 0 : 3 Horiz 4 : 7

ValueError Traceback (most recent call last)
in
15
16 conv_forward_test_1(z_mean, z_0_2_1, cache_0_1_2_3)
—> 17 conv_forward_test_2(conv_forward)

~/work/release/W1A1/public_tests.py in conv_forward_test_2(target)
85 b = np.random.randn(1, 1, 1, 8)
86
—> 87 Z, cache_conv = target(A_prev, W, b, {“pad” : 3, “stride”: 1})
88 Z_shape = Z.shape
89 assert Z_shape[0] == A_prev.shape[0], f"m is wrong. Current: {Z_shape[0]}. Expected: {A_prev.shape[0]}"

in conv_forward(A_prev, W, b, hparameters)
95 #print(“wshape”,weights.shape,“weights”,weights)
96 #print(“bShape”,biases.shape,“biases”,biases)
—> 97 Z[i, h, w, c] = conv_single_step(a_slice_prev, weights, biases)
98 print(“Z”,Z[i, h, w, c],“a_slice_prev.shape”,a_slice_prev.shape,“vert”,vert_start,“:”,vert_end," Horiz “, horiz_start,”:",horiz_end)
99

in conv_single_step(a_slice_prev, W, b)
23 # Z = None
24 # YOUR CODE STARTS HERE
—> 25 s = np.multiply(a_slice_prev,W)
26 Z = np.sum(s)
27 Z = Z + float(b)

ValueError: operands could not be broadcast together with shapes (3,2,4) (3,3,4)

1 Like

Yes, that is clearly wrong. So how did that happen? I also have some debugging print statements in my code that are a bit less voluminous. Here’s what I see for that first test case:

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!
stride 1 pad 3
New dimensions = 9 by 11
Shape Z = (2, 9, 11, 8)
Shape A_prev_pad = (2, 11, 13, 4)
Z[0,0,0,0] = 1.4306973717089302
Z[1,8,10,7] = -0.6695027738712113
stride 2 pad 0
New dimensions = 2 by 3
Shape Z = (2, 2, 3, 8)
Shape A_prev_pad = (2, 5, 7, 4)
Z[0,0,0,0] = 8.430161780192094
Z[1,1,2,7] = -0.2674960203423288
stride 1 pad 6
New dimensions = 13 by 15
Shape Z = (2, 13, 15, 8)
Shape A_prev_pad = (2, 17, 19, 4)
Z[0,0,0,0] = 0.5619706599772282
Z[1,12,14,7] = -1.622674822605305
Second Test: All tests passed!

I’m not sure how this could happen, but somehow it looks like the second dimension (w) of your a_slice_prev is being constrained by the size of the first dimension. Something is wrong in the indexing, but the normal way to make a mistake there is to reverse the meaning of h and w. h is not horizontal, it’s “height”, right? But if you use h to index the second dimension, then it wouldn’t give you the effect that you are seeing. Hmmmmm. But there is a problem somehow in that area.

The first thing to do would be to print the overall shapes of Z and A_prev_pad as I did above and compare your values to mine.

1 Like

@rws7349 I am taking a little bit of a guess here, but perhaps you are not pulling the weights and biases correctly.

To do so requires a little knowledge of ‘Python Voodoo’ in how you pull an entire range for a variable.

If it makes you feel any better, I had (still have) this in my code until I got there:

 #    print("Didn't get here !!!!!!!!!!!!!!!!!!!!!!!!!")
1 Like

Here are the first example values… the Z values are off… So, I guess the values passed to the Conv_single_step function are off… seems right from the pseudo code???

                weights = W[:, :, :, c]
                biases = b[0, 0, 0, c]

stride 2
pad 1
n_H 3
n_W 4
n_C 8
Z shape (2, 3, 4, 8)
A_prev_pad shape (2, 7, 9, 4)
Z[0,0,0,0] 1.2662814823774746
Z[1,2,3,7] 5.650559412813017
Z mean 1.0644642603114827

1 Like

@rws7349 you are pulling the biases wrong.

1 Like

I guess I’m lost on how to do that… Went back to the lecture notes…

Bias: n_C - (1,1,1,n_C)
Weights: ffn_C_prev*n_C

vs the Pseudo Code that I had…

thanks,

rick

1 Like

@rws7349 I used to be a teacher so I don’t want to ‘give you the answer’, just suggest. But you are pretty close. And we all make mistakes. I mean if you get to course five, Prof. Ng at one point speaks about a ‘bread’ of Egyptian dogs, and I at first thought ‘Wow, this model is going to be incredibly tough’, because I have no idea what a ‘bread of dog is’.

Yet, he just meant the word ‘breed’.

As long as we learn/progress though that is all I figure that matters.

Hang in there.

1 Like

The way you showed your handling of the bias values originally looks fine to me. I think it’s time to just look at your code. We can’t do that publicly, but check your DMs for a message from me.

1 Like

I think those are fine.

The most common error in this assignment is in not handling the stride correctly in the for-loops. ‘stride’ is a multiplier in the starting index calculations. Don’t use ‘stride’ in the range(…).

1 Like

@TMosh,

Perhaps I did it ‘wrong’, but not to give answers, only as a matter of interest: The ‘full call’ on both variables seemed to work for me (excepting channels)-- I think @paulinpaloalto is on it and you guys have better access than me. So it was just my ‘best guess’.

1 Like

Ok, Rick got all the hard parts correct. It took me a while to notice, but the issue is that inside the big loop, the code uses A_prev as the input instead of A_prev_pad.

3 Likes