Add tf_debug docs. Seal debugger API.
Change: 147395124
This commit is contained in:
parent
4514c71b3b
commit
f869fb0e58
tensorflow
@ -80,3 +80,8 @@ from tensorflow.python.debug.wrappers.dumping_wrapper import DumpingDebugWrapper
|
||||
from tensorflow.python.debug.wrappers.hooks import DumpingDebugHook
|
||||
from tensorflow.python.debug.wrappers.hooks import LocalCLIDebugHook
|
||||
from tensorflow.python.debug.wrappers.local_cli_wrapper import LocalCLIDebugWrapperSession
|
||||
|
||||
from tensorflow.python.util import all_util as _all_util
|
||||
|
||||
|
||||
_all_util.remove_undocumented(__name__)
|
||||
|
@ -68,6 +68,7 @@ py_binary(
|
||||
":parser",
|
||||
":py_guide_parser",
|
||||
"//tensorflow:tensorflow_py",
|
||||
"//tensorflow/python/debug:debug_py",
|
||||
"//tensorflow/tools/common:public_api",
|
||||
"//tensorflow/tools/common:traverse",
|
||||
],
|
||||
|
@ -37,14 +37,18 @@ class DocGeneratorVisitor(object):
|
||||
Args:
|
||||
root_name: The name of the root module/class.
|
||||
"""
|
||||
self._root_name = root_name or ''
|
||||
self._prefix = (root_name + '.') if root_name else ''
|
||||
self.set_root_name(root_name)
|
||||
self._index = {}
|
||||
self._tree = {}
|
||||
self._reverse_index = None
|
||||
self._duplicates = None
|
||||
self._duplicate_of = None
|
||||
|
||||
def set_root_name(self, root_name):
|
||||
"""Sets the root name for subsequent __call__s."""
|
||||
self._root_name = root_name or ''
|
||||
self._prefix = (root_name + '.') if root_name else ''
|
||||
|
||||
@property
|
||||
def index(self):
|
||||
"""A map from fully qualified names to objects to be documented.
|
||||
@ -114,6 +118,10 @@ class DocGeneratorVisitor(object):
|
||||
self._maybe_find_duplicates()
|
||||
return self._duplicates
|
||||
|
||||
def _add_prefix(self, name):
|
||||
"""Adds the root name to a name."""
|
||||
return self._prefix + name if name else self._root_name
|
||||
|
||||
def __call__(self, parent_name, parent, children):
|
||||
"""Visitor interface, see `tensorflow/tools/common:traverse` for details.
|
||||
|
||||
@ -132,7 +140,7 @@ class DocGeneratorVisitor(object):
|
||||
RuntimeError: If this visitor is called with a `parent` that is not a
|
||||
class or module.
|
||||
"""
|
||||
parent_name = self._prefix + parent_name if parent_name else self._root_name
|
||||
parent_name = self._add_prefix(parent_name)
|
||||
self._index[parent_name] = parent
|
||||
self._tree[parent_name] = []
|
||||
|
||||
|
@ -26,6 +26,8 @@ import sys
|
||||
import six
|
||||
import tensorflow as tf
|
||||
|
||||
from tensorflow.python import debug as tf_debug
|
||||
|
||||
from tensorflow.tools.common import public_api
|
||||
from tensorflow.tools.common import traverse
|
||||
from tensorflow.tools.docs import doc_generator_visitor
|
||||
@ -181,6 +183,10 @@ def extract():
|
||||
|
||||
traverse.traverse(tf, api_visitor)
|
||||
|
||||
# tf_debug is not imported with tf, it's a separate module altogether
|
||||
visitor.set_root_name('tfdbg')
|
||||
traverse.traverse(tf_debug, api_visitor)
|
||||
|
||||
return visitor
|
||||
|
||||
|
||||
@ -344,7 +350,8 @@ def other_docs(src_dir, output_dir, visitor, doc_index):
|
||||
output = parser.replace_references(
|
||||
md_string, relative_path_to_root, visitor.duplicate_of,
|
||||
doc_index=doc_index, index=visitor.index)
|
||||
open(full_out_path, 'w').write(header + output)
|
||||
with open(full_out_path, 'w') as f:
|
||||
f.write(header + output)
|
||||
|
||||
print('Done.')
|
||||
|
||||
|
@ -196,7 +196,7 @@ def _one_ref(string, relative_path_to_root, duplicate_of, doc_index, index):
|
||||
log_error('Handle doc reference "@{%s}"' % string)
|
||||
return 'TODO:%s' % string
|
||||
|
||||
elif string.startswith('tf'): # Python symbol
|
||||
elif string.startswith('tf.') or string.startswith('tfdbg.'): # Python symbol
|
||||
return _markdown_link(
|
||||
link_text, string, relative_path_to_root, duplicate_of, index)
|
||||
elif string.startswith('tensorflow::'): # C++ symbol
|
||||
|
Loading…
Reference in New Issue
Block a user