This method could be pushed into the sigmoid nonlinearity class.