Python tensorflow.python.util.nest.flatten_dict_items() Examples
The following are 1
code examples of tensorflow.python.util.nest.flatten_dict_items().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
tensorflow.python.util.nest
, or try the search function
.
Example #1
Source File: nest_test.py From deep_image_model with Apache License 2.0 | 6 votes |
def testFlattenDictItems(self): dictionary = {(4, 5, (6, 8)): ("a", "b", ("c", "d"))} flat = {4: "a", 5: "b", 6: "c", 8: "d"} self.assertEqual(nest.flatten_dict_items(dictionary), flat) with self.assertRaises(TypeError): nest.flatten_dict_items(4) bad_dictionary = {(4, 5, (4, 8)): ("a", "b", ("c", "d"))} with self.assertRaisesRegexp(ValueError, "not unique"): nest.flatten_dict_items(bad_dictionary) another_bad_dictionary = {(4, 5, (6, 8)): ("a", "b", ("c", ("d", "e")))} with self.assertRaisesRegexp( ValueError, "Key had [0-9]* elements, but value had [0-9]* elements"): nest.flatten_dict_items(another_bad_dictionary)