I read the source code of tensorflow on github and find gen_math_ops is imported.
from tensorflow.python.ops import gen_math_ops
However, i
Just to add to the previous answers, if your goal is to inspect the source code, try inspect.get_source
:
This file is machine generated.
You can find the generated file in .../site-packages/tensorflow/python/ops/gen_math_ops.py
For example, in Mac, you can find it at /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/tensorflow/python/ops/gen_math_ops.py.
Yaroslav has the right answer, but the link he provided is now broken. Here's a correct link to tensorflow.bzl.
In my case, I was interested in the internal workings of gen_array_ops._concat . It turns out that the gen*.py are automatically generated wrappers for the C++ kernels located here. You can typically guess the kernel op name, e.g., here was the one I was interested in.
It's automatically generated by tf_gen_op_wrapper_*
rules here.
Also you can use ?? in your IPython notebook to find location