# Course 4 Week 2 project 1

on the first assignment, i keep getting an error on the first model that i need to adjust my padding and strides. Here is what i am outputing, followed by the error message, followed by the expected output. How do i figure out the correct padding and strides?

With training=False

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

[[1.16404 1.16404 1.16404 1.81691]
[1.23441 1.23441 1.23441 1.3923 ]]

[[3.4921 3.4921 3.4921 5.45072]
[3.70323 3.70323 3.70323 4.17691]]]
1.2344106

With training=True

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

[[1. 1. 1. 1. ]
[1. 1. 1. 1. ]]

## [[3.10878 3.10878 3.10878 3.17659] [3.16359 3.16359 3.16359 3.34611]]]

AssertionError Traceback (most recent call last)
in
22 print(np.around(A4.numpy()[:,(0,-1),:,:].mean(axis = 3), 5))
23
â€”> 24 public_tests.identity_block_test(identity_block)

/tf/W2A1/public_tests.py in identity_block_test(target)
25 resume = A3np[:,(0,-1),:,:].mean(axis = 3)
26
â€”> 27 assert np.floor(resume[1, 0, 0]) == 2 * np.floor(resume[1, 0, 3]), â€śCheck the padding and stridesâ€ť
28 assert np.floor(resume[1, 0, 3]) == np.floor(resume[1, 1, 0]), â€śCheck the padding and stridesâ€ť
29 assert np.floor(resume[1, 1, 0]) == 2 * np.floor(resume[1, 1, 3]), â€śCheck the padding and stridesâ€ť

AssertionError: Check the padding and strides

Expected value

With training=False

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

[[192.71234 192.71234 192.71234 96.85617]
[ 96.85617 96.85617 96.85617 48.92808]]

[[578.1371 578.1371 578.1371 290.5685 ]
[290.5685 290.5685 290.5685 146.78426]]]
96.85617

With training=True

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

[[0.40739 0.40739 0.40739 0.40739]
[0.40739 0.40739 0.40739 0.40739]]

[[4.99991 4.99991 4.99991 3.25948]
[3.25948 3.25948 3.25948 2.40739]]]

i dont know why but whenever i post on here that i am stuck and need help, i figure it out like an hour or 2 later. lol

I am getting exact same output and error, could you please tell me what was wrong?

I manged to solve it. The problem was with kernel_size for second block. I had it as = (f,f) but worked only as = f.

1 Like