Dear community,
I have an issue with my code. Here is the error message:
TypeError Traceback (most recent call last)
in
7 dA = np.random.randn(5, 4, 2, 2)
8
----> 9 dA_prev1 = pool_backward(dA, cache, mode = “max”)
10 print(“mode = max”)
11 print('mean of dA = ', np.mean(dA))
in pool_backward(dA, cache, mode)
93 mask = create_mask_from_window((f,f))
94
—> 95 dA_prev[i, vert_start: vert_end, horiz_start: horiz_end, c] += np.dot(mask,distribute_value(a_prev_slice, a_prev_slice))
96
97 elif mode == “average”:
in distribute_value(dz, shape)
22 (n_H, n_W) = shape
23 average = dz/(n_H * n_W)
—> 24 a = average*np.ones((n_H,n_W))
25 print(a)
26
/opt/conda/lib/python3.7/site-packages/numpy/core/numeric.py in ones(shape, dtype, order)
205
206 “”"
→ 207 a = empty(shape, dtype, order)
208 multiarray.copyto(a, 1, casting=‘unsafe’)
209 return a
TypeError: only integer scalar arrays can be converted to a scalar index
Thanks in advance!
Olivier