def sigmoids(x):
    sigmoid = vectorize(lambda x: 1.0 / (1.0 + exp(-x)))
grad_sigmoid = vectorize(lambda x: sigmoid(x) * (1 - sigmoid(x)))
return sigmoid, grad_sigmoid
Numpy Pure Functions for performance, caching