From 430093879936ea0fbdfa7e056c5a46f20a2940c2 Mon Sep 17 00:00:00 2001 From: huangbo77 Date: Thu, 9 Dec 2021 11:06:04 +0800 Subject: [PATCH] Modifies test case for RandomChoiceWIthMask on mac --- tests/st/ops/cpu/test_random_choice_with_mask_op.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/st/ops/cpu/test_random_choice_with_mask_op.py b/tests/st/ops/cpu/test_random_choice_with_mask_op.py index 5ab7f77756a..ff72206a265 100644 --- a/tests/st/ops/cpu/test_random_choice_with_mask_op.py +++ b/tests/st/ops/cpu/test_random_choice_with_mask_op.py @@ -13,6 +13,7 @@ # limitations under the License. # ============================================================================ +import platform import numpy as np import pytest @@ -111,11 +112,16 @@ def test_RCWM_1D(): np.array([1, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1]).astype(np.bool)) expect_index = np.array([[11], [0], [8], [2], [9], [7], [10], [15], [0], [0]]).astype(np.int32) + expect_index_mac = np.array([[11], [7], [9], [15], [2], [10], + [8], [0], [0], [0]]).astype(np.int32) expect_mask = np.array( [True, True, True, True, True, True, True, True, False, False]) rcwm = RCWM_1D() output1, output2 = rcwm(input_tensor) print(output1.asnumpy()) print(output2) - assert np.array_equal(output1.asnumpy(), expect_index) + if platform.system().lower() == "darwin": + assert np.array_equal(output1.asnumpy(), expect_index_mac) + else: + assert np.array_equal(output1.asnumpy(), expect_index) assert np.array_equal(output2.asnumpy(), expect_mask)