File tree 1 file changed +12
-1
lines changed
1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -87,7 +87,9 @@ pub enum ValueType {
87
87
key : TensorElementType ,
88
88
/// The map value type.
89
89
value : TensorElementType
90
- }
90
+ } ,
91
+ /// An optional value, which may or may not contain a [`Value`].
92
+ Optional ( Box < ValueType > )
91
93
}
92
94
93
95
impl ValueType {
@@ -110,6 +112,15 @@ impl ValueType {
110
112
ortsys ! [ unsafe CastTypeInfoToMapTypeInfo ( typeinfo_ptr, & mut info_ptr) ?; nonNull( info_ptr) ] ;
111
113
unsafe { extract_data_type_from_map_info ( info_ptr) ? }
112
114
}
115
+ ort_sys:: ONNXType :: ONNX_TYPE_OPTIONAL => {
116
+ let mut info_ptr: * const ort_sys:: OrtOptionalTypeInfo = std:: ptr:: null_mut ( ) ;
117
+ ortsys ! [ unsafe CastTypeInfoToOptionalTypeInfo ( typeinfo_ptr, & mut info_ptr) ?; nonNull( info_ptr) ] ;
118
+
119
+ let mut contained_type: * mut ort_sys:: OrtTypeInfo = std:: ptr:: null_mut ( ) ;
120
+ ortsys ! [ unsafe GetOptionalContainedTypeInfo ( info_ptr, & mut contained_type) ?; nonNull( contained_type) ] ;
121
+
122
+ ValueType :: Optional ( Box :: new ( ValueType :: from_type_info ( contained_type) ?) )
123
+ }
113
124
_ => unreachable ! ( )
114
125
} ;
115
126
ortsys ! [ unsafe ReleaseTypeInfo ( typeinfo_ptr) ] ;
You can’t perform that action at this time.
0 commit comments