in tools/tensorflow_docs/api_generator/reference_resolver.py [0:0]
def _create_partial_symbols_dict(self):
"""Creates a partial symbols dictionary for all the symbols in TensorFlow.
Returns:
A dictionary mapping {partial_symbol: real_symbol}
"""
partial_symbols_dict = collections.defaultdict(list)
for name in sorted(self._all_names):
if 'tf.compat.v' in name or 'tf.contrib' in name:
continue
# TODO(yashkatariya): Remove `tf.experimental.numpy` after `tf.numpy` is
# in not in experimental namespace.
if 'tf.experimental.numpy' in name or 'tf.numpy' in name:
continue
partials = self._partial_symbols(name)
for partial in partials:
partial_symbols_dict[partial].append(name)
new_partial_dict = {}
for partial, full_names in partial_symbols_dict.items():
if not full_names:
continue
full_names = [
self._duplicate_of.get(full_name, full_name)
for full_name in full_names
]
new_partial_dict[partial] = full_names[0]
return new_partial_dict