示例#1
0
 def test_make_empty_list_structure_for_element_type_spec_w_tuple_dict(self):
   type_spec = computation_types.to_type(
       [tf.int32, [('a', tf.bool), ('b', tf.float32)]])
   structure = graph_utils.make_empty_list_structure_for_element_type_spec(
       type_spec)
   self.assertEqual(
       str(structure), '([], OrderedDict([(\'a\', []), (\'b\', [])]))')
示例#2
0
 def _test_list_structure(self, type_spec, elements, expected_output_str):
   structure = graph_utils.make_empty_list_structure_for_element_type_spec(
       type_spec)
   for element_value in elements:
     graph_utils.append_to_list_structure_for_element_type_spec(
         structure, element_value, type_spec)
   structure = (
       graph_utils.to_tensor_slices_from_list_structure_for_element_type_spec(
           structure, type_spec))
   self.assertEqual(
       str(structure).replace(' ', ''), expected_output_str.replace(' ', ''))