tf.contrib.framework.nest.flatten_dict_items(dictionary)
Defined in tensorflow/python/util/nest.py
.
Returns a dictionary with flattened keys and values.
This function flattens the keys and values of a dictionary, which can be arbitrarily nested structures, and returns the flattened version of such structures:
example_dictionary = {(4, 5, (6, 8)): ("a", "b", ("c", "d"))} result = {4: "a", 5: "b", 6: "c", 8: "d"} flatten_dict_items(example_dictionary) == result
The input dictionary must satisfy two properties:
dictionary
: the dictionary to zipThe zipped dictionary.
TypeError
: If the input is not a dictionary.ValueError
: If any key and value have not the same structure, or if keys are not unique.
© 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/flatten_dict_items