diff options
Diffstat (limited to 'tensorflow/tools/docs/doc_generator_visitor.py')
-rw-r--r-- | tensorflow/tools/docs/doc_generator_visitor.py | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/tensorflow/tools/docs/doc_generator_visitor.py b/tensorflow/tools/docs/doc_generator_visitor.py index 259a4694fd..c090dbd8da 100644 --- a/tensorflow/tools/docs/doc_generator_visitor.py +++ b/tensorflow/tools/docs/doc_generator_visitor.py @@ -20,6 +20,7 @@ from __future__ import print_function import six +from tensorflow.python.util import tf_export from tensorflow.python.util import tf_inspect @@ -201,7 +202,6 @@ class DocGeneratorVisitor(object): raw_duplicates[master_name] = [master_name, full_name] else: reverse_index[object_id] = full_name - # Decide on master names, rewire duplicates and make a duplicate_of map # mapping all non-master duplicates to the master name. The master symbol # does not have an entry in this map. @@ -211,10 +211,15 @@ class DocGeneratorVisitor(object): duplicates = {} for names in raw_duplicates.values(): names = sorted(names) - - # Choose the lexicographically first name with the minimum number of - # submodules. This will prefer highest level namespace for any symbol. - master_name = min(names, key=lambda name: name.count('.')) + master_name = ( + tf_export.get_canonical_name_for_symbol(self._index[names[0]]) + if names else None) + if master_name: + master_name = 'tf.%s' % master_name + else: + # Choose the lexicographically first name with the minimum number of + # submodules. This will prefer highest level namespace for any symbol. + master_name = min(names, key=lambda name: name.count('.')) duplicates[master_name] = names for name in names: |