def test_make_optional_value_info(self): # type: () -> None tensor_type_proto = helper.make_tensor_type_proto(elem_type=2, shape=[5]) tensor_val_into = helper.make_value_info(name='test', type_proto=tensor_type_proto) optional_type_proto = helper.make_optional_type_proto( tensor_type_proto) optional_val_info = helper.make_value_info( name='test', type_proto=optional_type_proto) self.assertEqual(optional_val_info.name, 'test') self.assertTrue(optional_val_info.type.optional_type) self.assertEqual(optional_val_info.type.optional_type.elem_type, tensor_val_into.type) # Test Sequence sequence_type_proto = helper.make_sequence_type_proto( tensor_type_proto) optional_type_proto = helper.make_optional_type_proto( sequence_type_proto) optional_val_info = helper.make_value_info( name='test', type_proto=optional_type_proto) self.assertEqual(optional_val_info.name, 'test') self.assertTrue(optional_val_info.type.optional_type) sequence_value_info = helper.make_value_info( name='test', type_proto=tensor_type_proto) self.assertEqual( optional_val_info.type.optional_type.elem_type.sequence_type. elem_type, sequence_value_info.type)
def test_make_seuence_value_info(self): # type: () -> None tensor_type_proto = helper.make_tensor_type_proto(elem_type=2, shape=None) sequence_type_proto = helper.make_sequence_type_proto( tensor_type_proto) sequence_val_info = helper.make_value_info( name='test', type_proto=sequence_type_proto) sequence_val_info_prim = helper.make_tensor_sequence_value_info( name='test', elem_type=2, shape=None) self.assertEqual(sequence_val_info, sequence_val_info_prim)