Reputation: 892
I'm looking for the exact definition of the sigmoid function in Keras with Tensorflow backend.
https://github.com/keras-team/keras/blob/master/keras/activations.py https://github.com/tensorflow/tensorflow/blob/master/tensorflow/python/ops/math_ops.py
Keras uses the tensorflow backend and tensorflow calls
from tensorflow.python.ops import gen_math_ops
which is machine generated. How can I find out the exact definition of the function if I've installed it in an anaconda environment?
Upvotes: 0
Views: 193
Reputation: 7124
As far as I can tell, it's defined in an external library, Eigen
(the op looks like it was recently renamed: https://bitbucket.org/eigen/eigen/diff/Eigen/src/Core/functors/UnaryFunctors.h?diff2=a18cf733769b&at=default)
I got to that from here: https://github.com/tensorflow/tensorflow/blob/master/tensorflow/core/kernels/cwise_ops.h#L659
They definitely didn't make it easy to find...
A nice trick for tracing the breadcrumb trail through machine-generated python files is to load the directory in ipython and use the ??
lookup. i.e.
In [1]: from tensorflow.python.ops import gen_math_ops
In [2]: gen_math_ops??
Upvotes: 1