@@ -54,7 +54,7 @@ def run_model(self, session_object, run_options):
5454 input_name = session_object .get_inputs ()[0 ].name
5555 res = session_object .run ([], {input_name : x }, run_options = run_options )
5656 output_expected = np .array ([[1.0 , 4.0 ], [9.0 , 16.0 ], [25.0 , 36.0 ]], dtype = np .float32 )
57- np .testing .assert_allclose (output_expected , res [0 ], rtol = 1e-05 , atol = 1e-08 )
57+ np .testing .assert_allclose (res [0 ], output_expected , rtol = 1e-05 , atol = 1e-08 )
5858
5959 def run_model_with_input (self , session_object , input_name , input_value , iter_num , queue ):
6060 for _ in range (iter_num ):
@@ -714,7 +714,7 @@ def test_run_model(self):
714714
715715 res = sess .run ([outputs [0 ].name ], {inputs [0 ].name : x })
716716 output_expected = np .array ([[1.0 , 4.0 ], [9.0 , 16.0 ], [25.0 , 36.0 ]], dtype = np .float32 )
717- np .testing .assert_allclose (output_expected , res [0 ], rtol = 1e-05 , atol = 1e-08 )
717+ np .testing .assert_allclose (res [0 ], output_expected , rtol = 1e-05 , atol = 1e-08 )
718718
719719 def test_run_async (self ):
720720 event = threading .Event ()
@@ -733,7 +733,7 @@ def callback(res: np.ndarray, data: MyData, err: str) -> None:
733733 self .assertEqual (len (err ), 0 )
734734 self .assertEqual (len (res ), 1 )
735735 self .assertEqual (data .get_id (), 123456 )
736- np .testing .assert_allclose (output_expected , res [0 ], rtol = 1e-05 , atol = 1e-08 )
736+ np .testing .assert_allclose (res [0 ], output_expected , rtol = 1e-05 , atol = 1e-08 )
737737 event .set ()
738738
739739 so = onnxrt .SessionOptions ()
@@ -762,7 +762,7 @@ def test_run_model_from_bytes(self):
762762 self .assertEqual (output_shape , [3 , 2 ])
763763 res = sess .run ([output_name ], {input_name : x })
764764 output_expected = np .array ([[1.0 , 4.0 ], [9.0 , 16.0 ], [25.0 , 36.0 ]], dtype = np .float32 )
765- np .testing .assert_allclose (output_expected , res [0 ], rtol = 1e-05 , atol = 1e-08 )
765+ np .testing .assert_allclose (res [0 ], output_expected , rtol = 1e-05 , atol = 1e-08 )
766766
767767 def test_run_model2 (self ):
768768 sess = onnxrt .InferenceSession (get_name ("matmul_1.onnx" ), providers = onnxrt .get_available_providers ())
@@ -777,7 +777,7 @@ def test_run_model2(self):
777777 self .assertEqual (output_shape , [3 , 1 ])
778778 res = sess .run ([output_name ], {input_name : x })
779779 output_expected = np .array ([[5.0 ], [11.0 ], [17.0 ]], dtype = np .float32 )
780- np .testing .assert_allclose (output_expected , res [0 ], rtol = 1e-05 , atol = 1e-08 )
780+ np .testing .assert_allclose (res [0 ], output_expected , rtol = 1e-05 , atol = 1e-08 )
781781
782782 def test_run_model2_contiguous (self ):
783783 sess = onnxrt .InferenceSession (get_name ("matmul_1.onnx" ), providers = onnxrt .get_available_providers ())
@@ -792,10 +792,10 @@ def test_run_model2_contiguous(self):
792792 self .assertEqual (output_shape , [3 , 1 ])
793793 res = sess .run ([output_name ], {input_name : x })
794794 output_expected = np .array ([[5.0 ], [11.0 ], [17.0 ]], dtype = np .float32 )
795- np .testing .assert_allclose (output_expected , res [0 ], rtol = 1e-05 , atol = 1e-08 )
795+ np .testing .assert_allclose (res [0 ], output_expected , rtol = 1e-05 , atol = 1e-08 )
796796 xcontiguous = np .ascontiguousarray (x )
797797 rescontiguous = sess .run ([output_name ], {input_name : xcontiguous })
798- np .testing .assert_allclose (output_expected , rescontiguous [0 ], rtol = 1e-05 , atol = 1e-08 )
798+ np .testing .assert_allclose (rescontiguous [0 ], output_expected , rtol = 1e-05 , atol = 1e-08 )
799799
800800 def test_run_model_multiple_threads (self ):
801801 # Skip this test for a "pure" DML onnxruntime python wheel.
@@ -860,14 +860,14 @@ def test_list_as_input(self):
860860 input_name = sess .get_inputs ()[0 ].name
861861 res = sess .run ([], {input_name : x .tolist ()})
862862 output_expected = np .array ([[1.0 , 4.0 ], [9.0 , 16.0 ], [25.0 , 36.0 ]], dtype = np .float32 )
863- np .testing .assert_allclose (output_expected , res [0 ], rtol = 1e-05 , atol = 1e-08 )
863+ np .testing .assert_allclose (res [0 ], output_expected , rtol = 1e-05 , atol = 1e-08 )
864864
865865 def test_string_list_as_input (self ):
866866 sess = onnxrt .InferenceSession (get_name ("identity_string.onnx" ), providers = available_providers_without_tvm )
867867 x = np .array (["this" , "is" , "identity" , "test" ], dtype = str ).reshape ((2 , 2 ))
868868 x_name = sess .get_inputs ()[0 ].name
869869 res = sess .run ([], {x_name : x .tolist ()})
870- np .testing .assert_equal (x , res [0 ])
870+ np .testing .assert_equal (res [0 ], x )
871871
872872 def test_run_device (self ):
873873 device = onnxrt .get_device ()
@@ -888,7 +888,7 @@ def test_run_model_symbolic_input(self):
888888 self .assertEqual (output_shape , ["None" , 1 ])
889889 res = sess .run ([output_name ], {input_name : x })
890890 output_expected = np .array ([[5.0 ], [11.0 ], [17.0 ]], dtype = np .float32 )
891- np .testing .assert_allclose (output_expected , res [0 ], rtol = 1e-05 , atol = 1e-08 )
891+ np .testing .assert_allclose (res [0 ], output_expected , rtol = 1e-05 , atol = 1e-08 )
892892
893893 def test_boolean_inputs (self ):
894894 sess = onnxrt .InferenceSession (get_name ("logicaland.onnx" ), providers = available_providers )
@@ -920,7 +920,7 @@ def test_boolean_inputs(self):
920920
921921 output_expected = np .array ([[True , False ], [False , False ]], dtype = bool )
922922 res = sess .run ([output_name ], {a_name : a , b_name : b })
923- np .testing .assert_equal (output_expected , res [0 ])
923+ np .testing .assert_equal (res [0 ], output_expected )
924924
925925 def test_string_input1 (self ):
926926 sess = onnxrt .InferenceSession (get_name ("identity_string.onnx" ), providers = available_providers_without_tvm )
@@ -941,7 +941,7 @@ def test_string_input1(self):
941941 self .assertEqual (output_type , "tensor(string)" )
942942
943943 res = sess .run ([output_name ], {x_name : x })
944- np .testing .assert_equal (x , res [0 ])
944+ np .testing .assert_equal (res [0 ], x )
945945
946946 def test_string_input2 (self ):
947947 sess = onnxrt .InferenceSession (get_name ("identity_string.onnx" ), providers = available_providers_without_tvm )
@@ -962,7 +962,7 @@ def test_string_input2(self):
962962 self .assertEqual (output_type , "tensor(string)" )
963963
964964 res = sess .run ([output_name ], {x_name : x })
965- np .testing .assert_equal (x , res [0 ])
965+ np .testing .assert_equal (res [0 ], x )
966966
967967 def test_input_bytes (self ):
968968 sess = onnxrt .InferenceSession (get_name ("identity_string.onnx" ), providers = available_providers_without_tvm )
@@ -983,7 +983,7 @@ def test_input_bytes(self):
983983 self .assertEqual (output_type , "tensor(string)" )
984984
985985 res = sess .run ([output_name ], {x_name : x })
986- np .testing .assert_equal (x , res [0 ].astype ("|S8" ))
986+ np .testing .assert_equal (res [0 ].astype ("|S8" ), x )
987987
988988 def test_input_object (self ):
989989 sess = onnxrt .InferenceSession (get_name ("identity_string.onnx" ), providers = available_providers_without_tvm )
@@ -1004,7 +1004,7 @@ def test_input_object(self):
10041004 self .assertEqual (output_type , "tensor(string)" )
10051005
10061006 res = sess .run ([output_name ], {x_name : x })
1007- np .testing .assert_equal (x , res [0 ])
1007+ np .testing .assert_equal (res [0 ], x )
10081008
10091009 def test_input_void (self ):
10101010 sess = onnxrt .InferenceSession (get_name ("identity_string.onnx" ), providers = available_providers_without_tvm )
@@ -1029,7 +1029,7 @@ def test_input_void(self):
10291029 res = sess .run ([output_name ], {x_name : x })
10301030
10311031 expr = np .array ([["must" , "have" ], ["same" , "size" ]], dtype = object )
1032- np .testing .assert_equal (expr , res [0 ])
1032+ np .testing .assert_equal (res [0 ], expr )
10331033
10341034 def test_raise_wrong_num_inputs (self ):
10351035 with self .assertRaises (ValueError ) as context :
@@ -1164,7 +1164,7 @@ def test_sequence_construct(self):
11641164 },
11651165 )
11661166
1167- np .testing .assert_array_equal (output_expected , res [0 ])
1167+ np .testing .assert_array_equal (res [0 ], output_expected )
11681168
11691169 def test_sequence_insert (self ):
11701170 opt = onnxrt .SessionOptions ()
@@ -1194,7 +1194,7 @@ def test_sequence_insert(self):
11941194 "input_seq" : [],
11951195 },
11961196 )
1197- np .testing .assert_array_equal (output_expected , res [0 ])
1197+ np .testing .assert_array_equal (res [0 ], output_expected )
11981198
11991199 def test_ort_execution_mode (self ):
12001200 opt = onnxrt .SessionOptions ()
@@ -1375,7 +1375,7 @@ def test_register_custom_ops_library(self):
13751375 input_1 = np .zeros ((3 , 5 )).astype (np .float32 )
13761376 res = sess1 .run ([output_name ], {input_name_0 : input_0 , input_name_1 : input_1 })
13771377 output_expected = np .ones ((3 , 5 )).astype (np .float32 )
1378- np .testing .assert_allclose (output_expected , res [0 ], rtol = 1e-05 , atol = 1e-08 )
1378+ np .testing .assert_allclose (res [0 ], output_expected , rtol = 1e-05 , atol = 1e-08 )
13791379
13801380 # Create an alias of SessionOptions instance
13811381 # We will use this alias to construct another InferenceSession
@@ -1969,7 +1969,7 @@ def test_adater_export_read(self):
19691969 self .assertTrue (value .is_tensor ())
19701970 self .assertEqual (expected_val .element_type (), value .element_type ())
19711971 self .assertEqual (expected_val .shape (), value .shape ())
1972- np .testing .assert_allclose (expected_val .numpy (), value .numpy ())
1972+ np .testing .assert_allclose (value .numpy (), expected_val .numpy ())
19731973
19741974 def test_run_with_adapter (self ):
19751975 model_path = get_name ("lora/two_params_lora_model.onnx" )
0 commit comments