For fast computations, I have to implement my sigmoid function in Numpy this is the code below
def sigmoid(Z):
"""
Implements the sigmoid activation in bumpy
Arguments:
Z -- numpy array of any shape
Returns:
A -- output of sigmoid(z), same shape as Z
cache -- returns Z, useful during backpropagation
"""
cache=Z
print(type(Z))
print(Z)
A=1/(1+(np.exp((-Z))))
return A, cache
Also some relevant information:
Z=(np.matmul(W,A)+b)
and the type of Z is:
<class 'numpy.ndarray'>
Sadly I am getting a: "bad operand type for unary -: 'tuple' " I have tried to work around this problem without any luck.I appreciate any suggestions. Best