Hi @TMosh , I checked the dimensions as you suggested and now I get at least a first result for Z.
However, I am still getting the “only size-1 arrays can be converted to Python scalars
” error on the 2nd iteration:
TypeError Traceback (most recent call last)
<ipython-input-41-182241fd5e53> in <module>
6 "stride": 2}
7
----> 8 Z, cache_conv = conv_forward(A_prev, W, b, hparameters)
9 print("Z's mean =\n", np.mean(Z))
10 print("Z[0,2,1] =\n", Z[0, 2, 1])
<ipython-input-40-95aab82c1890> in conv_forward(A_prev, W, b, hparameters)
98 weights = W[ : , : , c : c+1 , c : c+1]
99 biases = b [ : , : , c : c+1 , c : c+1]
--> 100 print(f'conv_single_step func -> {conv_single_step(a_slice_prev, weights, biases)}')
101 Z[i, h, w, c] = conv_single_step(a_slice_prev, weights, biases)
102
<ipython-input-4-0dc5d6ead47d> in conv_single_step(a_slice_prev, W, b)
26 s = a_slice_prev * W
27 Z = np.sum(s, dtype=np.float)
---> 28 Z += np.float(b)
29
30 # YOUR CODE ENDS HERE
TypeError: only size-1 arrays can be converted to Python scalars
Maybe the problem is in the n_c
vs n_c_prev
dimensions. But I am stuck for several hours now. Any pointers would be appreciated (and the print is for debugging purposes only).
Thank you