Defined in tensorflow/python/util/nest.py.
This module can perform operations on nested structures. A nested structure is a Python sequence, tuple (including namedtuple), or dict that can contain further sequences, tuples, and dicts.
The utilities here assume (and do not check) that the nested structures form a 'tree', i.e., no references in the structure of the input of these functions should be recursive.
Example structures: ((3, 4), 5, (6, 7, (9, 10), 8)), (np.array(0), (np.array([3, 4]), tf.constant([3, 4])))
assert_same_structure(...): Asserts that two structures are nested in the same way.
assert_shallow_structure(...): Asserts that shallow_tree is a shallow structure of input_tree.
flatten(...): Returns a flat list from a given nested structure.
flatten_dict_items(...): Returns a dictionary with flattened keys and values.
flatten_up_to(...): Flattens input_tree up to shallow_tree.
flatten_with_joined_string_paths(...): Returns a list of (string path, data element) tuples.
get_traverse_shallow_structure(...): Generates a shallow structure from a traverse_fn and structure.
is_sequence(...): Returns a true if its input is a collections.Sequence (except strings).
map_structure(...): Applies func to each entry in structure and returns a new structure.
map_structure_up_to(...): Applies a function or op to a number of partially flattened inputs.
pack_sequence_as(...): Returns a given flattened sequence packed into a given structure.
yield_flat_paths(...): Yields paths for some nested structure.
__cached__
__loader__
__spec__
© 2018 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 3.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/api_docs/python/tf/contrib/framework/nest