user7867665
user7867665

Reputation: 892

Definition of sigmoid function in tensorflow

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

Answers (1)

Ben
Ben

Reputation: 7124

As far as I can tell, it's defined in an external library, Eigen

https://bitbucket.org/eigen/eigen/src/6ede590db55c9427bf35a115c011eb545438c84a/Eigen/src/Core/functors/UnaryFunctors.h?at=default&fileviewer=file-view-default#UnaryFunctors.h-831

(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

Related Questions