DLS Course 4 CNN week 1 hw 1

have worked on the conv_forward(A_prev, W, b, hparameters) function. I have an answer coming out, but test 1 indicates that it is wrong. I have tried every which way to examine the bias, the weights the slicing, but they all appear to be correct. I used the test that was successful against the conv_single_step() method and verified that the conv_forward(A_prev, W, b, hparameters) gets the correct answer still with this test:

np.random.seed(1)
a_slice_prev = np.random.randn(1, 4, 4, 3)
W = np.random.randn(4, 4, 3, 1)
W1 = np.zeros((4,4,3,2))
W1[:,:,:,0] = W[:,:,:,0]
W1[:,:,:,1] = W[:,:,:,0]
b = np.random.randn(1, 1, 1, 1)
b1 = np.zeros((1,1,1,2))
b1[:,:,:,0] = b[:,:,:,0]
b1[:,:,:,1] = b[:,:,:,0]
hparameters = {“pad” : 0,
“stride”: 1}
Z,cache = conv_forward(a_slice_prev, W1, b1, hparameters)
print(“Z =”, Z[0,0,0])

assert (type(Z[0,0,0,0]) == np.float64), “You must cast the output to numpy float 64”
assert np.isclose(Z[0,0,0,0], -6.999089450680221), “Wrong value”

For test one of the conv_forward(A_prev, W, b, hparameters) method testing though I keep getting:

First Test: Z’s mean is incorrect. Expected: 0.5511276474566768
Your output: 0.5329033220060434

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: [-0.05723279 0.03991888 -6.24285862 0.53960581 -5.04059676 6.96991358
3.69509379 -0.20955895]

Any ideas?

If this topic doesn’t help, please click my name and message your notebook as an attachment.