hello community, I am having this error, I have done a lot of debugging during the last two days and I can’t find the error, even I have been reading the post in the community but no answer at all. I am going to post my solution, I hope any moderator reads this as fast as possible and gives me an answer, feel free to delete the code once you read it.
btw, it could exist some print lines, the purpose of those lines is only for debugging.
<< code removed>>
ValueError Traceback (most recent call last)
in
11 print(“cache_conv[0][1][2][3] =\n”, cache_conv[0][1][2][3])
12
—> 13 conv_forward_test(conv_forward)
~/work/release/W1A1/public_tests.py in conv_forward_test(target)
65 b = np.random.randn(1, 1, 1, 8)
66
—> 67 Z, cache_conv = target(A_prev, W, b, {“pad” : 3, “stride”: 1})
68 Z_shape = Z.shape
69 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)
105 print(a_slice_prev.shape)
106 #print(weights.shape)
→ 107 Z[i, h, w, c] = conv_single_step(a_slice_prev, weights, biases)
108 # YOUR CODE ENDS HERE
109
in conv_single_step(a_slice_prev, W, b)
23 # Z = None
24 # YOUR CODE STARTS HERE
—> 25 s = a_slice_prev*W
26 Z = np.sum(s,keepdims = True)
27 Z = np.squeeze(np.add(Z,b))[()]
ValueError: operands could not be broadcast together with shapes (2,3,4) (3,3,4)