From 190e80747f4779d47cfe0a0c73da75c9c7a608a1 Mon Sep 17 00:00:00 2001 From: kangguangli Date: Thu, 6 Jul 2023 14:35:22 +0800 Subject: [PATCH] fix bug in output check (#55164) --- test/legacy_test/eager_op_test.py | 34 +++++++++++++++++-------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/test/legacy_test/eager_op_test.py b/test/legacy_test/eager_op_test.py index b15f88fea03..04f9c0240f3 100644 --- a/test/legacy_test/eager_op_test.py +++ b/test/legacy_test/eager_op_test.py @@ -1146,21 +1146,25 @@ class OpTest(unittest.TestCase): fetch_list=fetch_list, return_numpy=False, ) - np.testing.assert_array_equal( - outs, - ir_outs, - err_msg='Operator (' - + self.op_type - + ') has diff at ' - + str(place) - + '\nExpect ' - + str(outs) - + '\n' - + 'But Got' - + str(ir_outs) - + ' in class ' - + self.__class__.__name__, - ) + assert len(outs) == len( + ir_outs + ), "Fetch result should have same length when executed in new ir" + for i in range(len(outs)): + np.testing.assert_array_equal( + outs[i], + ir_outs[i], + err_msg='Operator Check (' + + self.op_type + + ') has diff at ' + + str(place) + + '\nExpect ' + + str(outs[i]) + + '\n' + + 'But Got' + + str(ir_outs[i]) + + ' in class ' + + self.__class__.__name__, + ) set_flags({"FLAGS_enable_new_ir_in_executor": False}) -- GitLab