@@ -62,19 +62,21 @@ def test_string_type(self):
6262 s = string_type (obj )
6363 self .assertEqual (s , "dict(a:A7r1,b:#1[float],c:(int,))" )
6464
65+ @hide_stdout ()
6566 def test_string_dict (self ):
6667 a = np .array ([1 ], dtype = np .float32 )
6768 obj = {"a" : a , "b" : {"r" : 5.6 }, "c" : {1 }}
68- s = string_type (obj )
69+ s = string_type (obj , verbose = 10 )
6970 self .assertEqual (s , "dict(a:A1r1,b:dict(r:float),c:{int})" )
7071
72+ @hide_stdout ()
7173 def test_string_type_array (self ):
7274 a = np .array ([1 ], dtype = np .float32 )
7375 t = torch .tensor ([1 ])
7476 obj = {"a" : a , "b" : t }
75- s = string_type (obj , with_shape = False )
77+ s = string_type (obj , with_shape = False , verbose = 10 )
7678 self .assertEqual (s , "dict(a:A1r1,b:T7r1)" )
77- s = string_type (obj , with_shape = True )
79+ s = string_type (obj , with_shape = True , verbose = 10 )
7880 self .assertEqual (s , "dict(a:A1s1,b:T7s1)" )
7981
8082 def test_string_sig_f (self ):
@@ -92,6 +94,17 @@ def __init__(self, a, b=3, c=4, e=5):
9294 ssig = string_sig (A (1 , c = 8 ))
9395 self .assertEqual (ssig , "A(a=1, c=8)" )
9496
97+ def test_ort_value (self ):
98+ import onnxruntime as onnxrt
99+
100+ numpy_arr_input = np .array ([[1.0 , 2.0 ], [3.0 , 4.0 ], [5.0 , 6.0 ]], dtype = np .float32 )
101+ ortvalue = onnxrt .OrtValue .ortvalue_from_numpy (numpy_arr_input )
102+ self .assertEqual ("OV1r2" , string_type (ortvalue ))
103+ self .assertEqual ("OV1s3x2" , string_type (ortvalue , with_shape = True ))
104+ self .assertEqual (
105+ "OV(NO-NUMPY:FIXIT)" , string_type (ortvalue , with_shape = True , with_min_max = True )
106+ )
107+
95108 def test_pretty_onnx (self ):
96109 proto = oh .make_model (
97110 oh .make_graph (
@@ -122,7 +135,8 @@ def test_print_pretty_onnx(self):
122135 [
123136 oh .make_node ("Sigmoid" , ["Y" ], ["sy" ]),
124137 oh .make_node ("Mul" , ["Y" , "sy" ], ["ysy" ]),
125- oh .make_node ("Mul" , ["X" , "ysy" ], ["final" ]),
138+ oh .make_node ("Cast" , ["ysy" ], ["ysyy" ], to = 1 ),
139+ oh .make_node ("Mul" , ["X" , "ysyy" ], ["final" ]),
126140 ],
127141 "-nd-" ,
128142 [
0 commit comments