1

I have a question about this import from
tensorflow/tensorflow/python/summary/summary.py line 53:

from tensorflow.python.ops import gen_logging_ops as _gen_logging_ops

When I go to the directory tensorflow/python/ops, there is no such file called gen_logging_ops.

I am wondering how this worked out? BTW, I am tracking the r1.3 version.

Any suggestion is highly appreciated!

pfm
  • 6,210
  • 4
  • 39
  • 44

1 Answers1

1

I had a similar question. gen_ files are files generated at build time by bazel and if you build TensorFlow yourself, they can be found in the bazel-genfiles/ directory.

The tf_op_gen_wrapper_py bazel rule is the rule generating the gen_ files. As explained, in this answer, this rule generates all the python wrapper of the ops defined in this library:

py_library(
    name = "logging_ops",
    srcs = ["ops/logging_ops.py"],
    srcs_version = "PY2AND3",
    deps = [
        ":framework_for_generated_wrappers",
        ":logging_ops_gen",
        ":util",
    ],
)

In the logging_ops case there is an indirection: the call to tf_op_gen_wrapper_py is hidden in tf_gen_op_wrapper_private_py:

 tf_gen_op_wrapper_private_py(
    name = "logging_ops_gen",
    visibility = [
        "//learning/brain/python/ops:__pkg__",
        "//tensorflow/python/kernel_tests:__pkg__",
    ],
)
pfm
  • 6,210
  • 4
  • 39
  • 44