I am getting the below error:
(2, 7, 9, 4)
Z’s mean =
0.8837799868977424
Z[0,2,1] =
[10.76716029 6.05837302 2.14966486 10.34035645 9.51530963 -7.63337335
9.38081853 10.43136103]
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: 0.8837799868977424 . 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: [10.76716029 6.05837302 2.14966486 10.34035645 9.51530963 -7.63337335
9.38081853 10.43136103] Make sure you include stride in your calculation
I am following the pseudocode in Course 4 Week 1 Exercise 3 - conv_forward Error: Wrong output for variable in position 0
Log statements:
A_prev shape 2 5 7 4
W shape 3 3 4 8
stride 2
CurrentActiation shape n_H 3 n_W 4
(2, 7, 9, 4)
After padding (2, 7, 9, 4)
a_prev_pad (7, 9, 4)
Vertical index start end 0 3
Horizontal index start end 0 3
Z[0, 0, 0, 0] : 0.7241873303624353
Z[0, 0, 0, 1] : 2.307171162194142
Z[0, 0, 0, 2] : -7.906716521478254
Z[0, 0, 0, 3] : 0.3470750543542468
Z[0, 0, 0, 4] : -2.9066213975367274
Z[0, 0, 0, 5] : -1.9186764956632123
Z[0, 0, 0, 6] : -5.863902821556679
Z[0, 0, 0, 7] : 5.507995511689806
Horizontal index start end 2 5
Z[0, 0, 1, 0] : 0.9317234177885863
Z[0, 0, 1, 1] : 11.187300240410675
Z[0, 0, 1, 2] : -5.440624960986517
Z[0, 0, 1, 3] : 6.051901455253639
Z[0, 0, 1, 4] : -9.002540685114775
Z[0, 0, 1, 5] : 9.842356435587629
Z[0, 0, 1, 6] : 8.205274720495641
Z[0, 0, 1, 7] : -12.38173397865049
Horizontal index start end 4 7
Z[0, 0, 2, 0] : 4.878712949792419
Z[0, 0, 2, 1] : -5.232036872200803
Z[0, 0, 2, 2] : -3.899450318317641
Z[0, 0, 2, 3] : 2.5983499701045476
Z[0, 0, 2, 4] : -4.924545983869402
Z[0, 0, 2, 5] : 1.8722957212252815
Z[0, 0, 2, 6] : -2.713912694519111
Z[0, 0, 2, 7] : 3.7450691023544587
Horizontal index start end 6 9
Z[0, 0, 3, 0] : -1.4689599242762585
Z[0, 0, 3, 1] : -1.0959640434354934
Z[0, 0, 3, 2] : -2.927371430153968
Z[0, 0, 3, 3] : 7.8542852033166115
Z[0, 0, 3, 4] : -2.0563732773304833
Z[0, 0, 3, 5] : 1.3995967925071269
Z[0, 0, 3, 6] : 0.18075062019193364
Z[0, 0, 3, 7] : 2.151939424188021
Vertical index start end 2 5
Horizontal index start end 0 3
Z[0, 1, 0, 0] : 1.4380457566621803
Z[0, 1, 0, 1] : -2.268323841237544
Z[0, 1, 0, 2] : 11.113685698059546
Z[0, 1, 0, 3] : 3.390876521946942
Z[0, 1, 0, 4] : 6.741950026752265
Z[0, 1, 0, 5] : 2.868266722504116
Z[0, 1, 0, 6] : -0.6300550067059175
Z[0, 1, 0, 7] : 1.9891811545936577
Horizontal index start end 2 5
Z[0, 1, 1, 0] : -0.2959685916566741
Z[0, 1, 1, 1] : -6.758984698596256
Z[0, 1, 1, 2] : 7.22676156581304
Z[0, 1, 1, 3] : 5.368940033741598
Z[0, 1, 1, 4] : -8.800325500736939
Z[0, 1, 1, 5] : 11.43237343797162
Z[0, 1, 1, 6] : 7.201928532024472
Z[0, 1, 1, 7] : 8.312070063362382
Horizontal index start end 4 7
Z[0, 1, 2, 0] : -8.570346584299436
Z[0, 1, 2, 1] : -3.093274197766301
Z[0, 1, 2, 2] : -12.007040937567004
Z[0, 1, 2, 3] : -5.280780211701437
Z[0, 1, 2, 4] : 9.986320167081837
Z[0, 1, 2, 5] : -4.2934579269424535
Z[0, 1, 2, 6] : 5.693738392366574
Z[0, 1, 2, 7] : -10.605612124573897
Horizontal index start end 6 9
Z[0, 1, 3, 0] : 3.1066303018641444
Z[0, 1, 3, 1] : 5.105200447944384
Z[0, 1, 3, 2] : 0.6630966252526478
Z[0, 1, 3, 3] : 10.308801562475612
Z[0, 1, 3, 4] : 9.06988771742324
Z[0, 1, 3, 5] : 3.0298411488966996
Z[0, 1, 3, 6] : -5.816814573410771
Z[0, 1, 3, 7] : 4.1945945167550285
Vertical index start end 4 7
Horizontal index start end 0 3
Z[0, 2, 0, 0] : -6.119644137183075
Z[0, 2, 0, 1] : -5.239029540924501
Z[0, 2, 0, 2] : -12.165147552800256
Z[0, 2, 0, 3] : -9.731191587576443
Z[0, 2, 0, 4] : -4.523781463179992
Z[0, 2, 0, 5] : 5.297958093669381
Z[0, 2, 0, 6] : -0.44560345572184656
Z[0, 2, 0, 7] : 3.469113550629437
Horizontal index start end 2 5
Z[0, 2, 1, 0] : 10.767160292175628
Z[0, 2, 1, 1] : 6.058373023165004
Z[0, 2, 1, 2] : 2.149664856175172
Z[0, 2, 1, 3] : 10.340356454745782
Z[0, 2, 1, 4] : 9.51530963404043
Z[0, 2, 1, 5] : -7.633373353307459
Z[0, 2, 1, 6] : 9.38081852722986
Z[0, 2, 1, 7] : 10.431361028442366
Horizontal index start end 4 7
Z[0, 2, 2, 0] : -5.1604210189795285
Z[0, 2, 2, 1] : 8.69408699632557
Z[0, 2, 2, 2] : -0.39142128609396915
Z[0, 2, 2, 3] : -4.494756396025378
Z[0, 2, 2, 4] : -15.157737367200072
Z[0, 2, 2, 5] : 9.005500201435607
Z[0, 2, 2, 6] : 2.8280971870500338
Z[0, 2, 2, 7] : 8.31306508576437
Horizontal index start end 6 9
Z[0, 2, 3, 0] : 6.426007374312955
Z[0, 2, 3, 1] : -3.435489775627811
Z[0, 2, 3, 2] : 3.1179746202483476
Z[0, 2, 3, 3] : -3.6720330696313397
Z[0, 2, 3, 4] : 2.5965862782786058
Z[0, 2, 3, 5] : -0.8319059038739147
Z[0, 2, 3, 6] : 0.48357725080367564
Z[0, 2, 3, 7] : 5.101644290791892
Z mean: 0.4418899934488712
a_prev_pad (1, 7, 9, 4)
Vertical index start end 0 3
Horizontal index start end 0 3
Z[1, 0, 0, 0] : 0.7241873303624353
Z[1, 0, 0, 1] : 2.307171162194142
Z[1, 0, 0, 2] : -7.906716521478254
Z[1, 0, 0, 3] : 0.3470750543542468
Z[1, 0, 0, 4] : -2.9066213975367274
Z[1, 0, 0, 5] : -1.9186764956632123
Z[1, 0, 0, 6] : -5.863902821556679
Z[1, 0, 0, 7] : 5.507995511689806
Horizontal index start end 2 5
Z[1, 0, 1, 0] : 0.9317234177885863
Z[1, 0, 1, 1] : 11.187300240410675
Z[1, 0, 1, 2] : -5.440624960986517
Z[1, 0, 1, 3] : 6.051901455253639
Z[1, 0, 1, 4] : -9.002540685114775
Z[1, 0, 1, 5] : 9.842356435587629
Z[1, 0, 1, 6] : 8.205274720495641
Z[1, 0, 1, 7] : -12.38173397865049
Horizontal index start end 4 7
Z[1, 0, 2, 0] : 4.878712949792419
Z[1, 0, 2, 1] : -5.232036872200803
Z[1, 0, 2, 2] : -3.899450318317641
Z[1, 0, 2, 3] : 2.5983499701045476
Z[1, 0, 2, 4] : -4.924545983869402
Z[1, 0, 2, 5] : 1.8722957212252815
Z[1, 0, 2, 6] : -2.713912694519111
Z[1, 0, 2, 7] : 3.7450691023544587
Horizontal index start end 6 9
Z[1, 0, 3, 0] : -1.4689599242762585
Z[1, 0, 3, 1] : -1.0959640434354934
Z[1, 0, 3, 2] : -2.927371430153968
Z[1, 0, 3, 3] : 7.8542852033166115
Z[1, 0, 3, 4] : -2.0563732773304833
Z[1, 0, 3, 5] : 1.3995967925071269
Z[1, 0, 3, 6] : 0.18075062019193364
Z[1, 0, 3, 7] : 2.151939424188021
Vertical index start end 2 5
Horizontal index start end 0 3
Z[1, 1, 0, 0] : 1.4380457566621803
Z[1, 1, 0, 1] : -2.268323841237544
Z[1, 1, 0, 2] : 11.113685698059546
Z[1, 1, 0, 3] : 3.390876521946942
Z[1, 1, 0, 4] : 6.741950026752265
Z[1, 1, 0, 5] : 2.868266722504116
Z[1, 1, 0, 6] : -0.6300550067059175
Z[1, 1, 0, 7] : 1.9891811545936577
Horizontal index start end 2 5
Z[1, 1, 1, 0] : -0.2959685916566741
Z[1, 1, 1, 1] : -6.758984698596256
Z[1, 1, 1, 2] : 7.22676156581304
Z[1, 1, 1, 3] : 5.368940033741598
Z[1, 1, 1, 4] : -8.800325500736939
Z[1, 1, 1, 5] : 11.43237343797162
Z[1, 1, 1, 6] : 7.201928532024472
Z[1, 1, 1, 7] : 8.312070063362382
Horizontal index start end 4 7
Z[1, 1, 2, 0] : -8.570346584299436
Z[1, 1, 2, 1] : -3.093274197766301
Z[1, 1, 2, 2] : -12.007040937567004
Z[1, 1, 2, 3] : -5.280780211701437
Z[1, 1, 2, 4] : 9.986320167081837
Z[1, 1, 2, 5] : -4.2934579269424535
Z[1, 1, 2, 6] : 5.693738392366574
Z[1, 1, 2, 7] : -10.605612124573897
Horizontal index start end 6 9
Z[1, 1, 3, 0] : 3.1066303018641444
Z[1, 1, 3, 1] : 5.105200447944384
Z[1, 1, 3, 2] : 0.6630966252526478
Z[1, 1, 3, 3] : 10.308801562475612
Z[1, 1, 3, 4] : 9.06988771742324
Z[1, 1, 3, 5] : 3.0298411488966996
Z[1, 1, 3, 6] : -5.816814573410771
Z[1, 1, 3, 7] : 4.1945945167550285
Vertical index start end 4 7
Horizontal index start end 0 3
Z[1, 2, 0, 0] : -6.119644137183075
Z[1, 2, 0, 1] : -5.239029540924501
Z[1, 2, 0, 2] : -12.165147552800256
Z[1, 2, 0, 3] : -9.731191587576443
Z[1, 2, 0, 4] : -4.523781463179992
Z[1, 2, 0, 5] : 5.297958093669381
Z[1, 2, 0, 6] : -0.44560345572184656
Z[1, 2, 0, 7] : 3.469113550629437
Horizontal index start end 2 5
Z[1, 2, 1, 0] : 10.767160292175628
Z[1, 2, 1, 1] : 6.058373023165004
Z[1, 2, 1, 2] : 2.149664856175172
Z[1, 2, 1, 3] : 10.340356454745782
Z[1, 2, 1, 4] : 9.51530963404043
Z[1, 2, 1, 5] : -7.633373353307459
Z[1, 2, 1, 6] : 9.38081852722986
Z[1, 2, 1, 7] : 10.431361028442366
Horizontal index start end 4 7
Z[1, 2, 2, 0] : -5.1604210189795285
Z[1, 2, 2, 1] : 8.69408699632557
Z[1, 2, 2, 2] : -0.39142128609396915
Z[1, 2, 2, 3] : -4.494756396025378
Z[1, 2, 2, 4] : -15.157737367200072
Z[1, 2, 2, 5] : 9.005500201435607
Z[1, 2, 2, 6] : 2.8280971870500338
Z[1, 2, 2, 7] : 8.31306508576437
Horizontal index start end 6 9
Z[1, 2, 3, 0] : 6.426007374312955
Z[1, 2, 3, 1] : -3.435489775627811
Z[1, 2, 3, 2] : 3.1179746202483476
Z[1, 2, 3, 3] : -3.6720330696313397
Z[1, 2, 3, 4] : 2.5965862782786058
Z[1, 2, 3, 5] : -0.8319059038739147
Z[1, 2, 3, 6] : 0.48357725080367564
Z[1, 2, 3, 7] : 5.101644290791892
Z mean: 0.8837799868977424
Please advise.
Thank you!