Greetings,
First off, sorry if this is obvious, but without knowing what the checker is expecting, it is hard to find bugs. I made a leap by jumping into this course without completing the previous ones in the Deep Learning track, nor did I program in Python before. Thank you in advance for any insights.
My code:
# YOUR CODE STARTS HERE
(m, n_H_prev, n_W_prev, n_C_prev) = A_prev.shape
(f, f, n_C_prev, n_C) = W.shape
stride = hparameters[“stride”]
pad = hparameters[“pad”]
n_H = ((n_H_prev - f + 2 * pad) // stride) + 1
n_W = ((n_W_prev - f + 2 * pad) // stride) + 1
Z = np.zeros((m, n_H, n_W, n_C))
A_prev_pad = zero_pad(A_prev, pad)
for i in range(m):
a_prev_pad = A_prev_pad[i]
for h in range(0, n_H, stride):
vert_start = h
vert_end = h + f
for w in range(0, n_W, stride):
horiz_start = w
horiz_end = w + f
a_slice_prev = a_prev_pad[vert_start:vert_end, horiz_start:horiz_end, :]
for c in range(n_C):
weights = W[:,:,:,c]
biases = b[:,:,:,c]
Z[i, h, w, c] = conv_single_step(a_slice_prev, weights, biases)
# YOUR CODE ENDS HERE
The checker output:
Z’s mean =
0.28648854269868845
Z[0,2,1] =
[0. 0. 0. 0. 0. 0. 0. 0.]
cache_conv[0][1][2][3] =
[-1.1191154 1.9560789 -0.3264995 -1.34267579]
(2, 13, 15, 8)
Error: Wrong output for variable in position 0.
2 Tests passed
1 Tests failed