Error:-
TypeError Traceback (most recent call last)
in
3 X =np.array([[1., 2., -1.], [3., 4., -3.2]])
4 Y = np.array([[1, 0, 1]])
----> 5 grads, cost = propagate(w, b, X, Y)
6
7 assert type(grads[“dw”]) == np.ndarray
in propagate(w, b, X, Y)
30 # YOUR CODE STARTS HERE
31 A = sigmoid(np.dot(w.T,X)+b)
—> 32 cost = (-1/m)*(np.sum(Y * np.log(A),(1-Y) * np.log(1-A),keepdims=True))
33
34 # YOUR CODE ENDS HERE
<array_function internals> in sum(*args, **kwargs)
/opt/conda/lib/python3.7/site-packages/numpy/core/fromnumeric.py in sum(a, axis, dtype, out, keepdims, initial, where)
2227
2228 return _wrapreduction(a, np.add, ‘sum’, axis, dtype, out, keepdims=keepdims,
→ 2229 initial=initial, where=where)
2230
2231
/opt/conda/lib/python3.7/site-packages/numpy/core/fromnumeric.py in _wrapreduction(obj, ufunc, method, axis, dtype, out, **kwargs)
88 return reduction(axis=axis, out=out, **passkwargs)
89
—> 90 return ufunc.reduce(obj, axis, dtype, out, **passkwargs)
91
92
TypeError: only integer scalar arrays can be converted to a scalar index
Please help as soon as possible
Thanks