From d919aaebc7e039127d6ce49d380736914dc26bae Mon Sep 17 00:00:00 2001 From: Megvii Engine Team Date: Fri, 11 Feb 2022 16:46:34 +0800 Subject: [PATCH] test(imperative): reopen special interpolate test and sync when test rng GitOrigin-RevId: e3d03b4d1d981ebf7afc8be6fe79fb5928f81aac --- imperative/python/test/unit/functional/test_functional.py | 2 +- imperative/python/test/unit/random/test_rng.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/imperative/python/test/unit/functional/test_functional.py b/imperative/python/test/unit/functional/test_functional.py index e38c10eb..2a96c1d0 100644 --- a/imperative/python/test/unit/functional/test_functional.py +++ b/imperative/python/test/unit/functional/test_functional.py @@ -507,7 +507,7 @@ def test_interpolate_fastpath(): [(1, 1, 10, 10), (5, 5)], [(1, 3, 10, 10), (20, 20)], [(10, 1, 10, 10), (1, 1)], - # [(10, 10, 1, 1), (10, 10)], # FIXME, it causes random CI failure + [(10, 10, 1, 1), (10, 10)], ] for inp_shape, target_shape in test_cases: x = tensor(np.random.randn(*inp_shape), dtype=np.float32) diff --git a/imperative/python/test/unit/random/test_rng.py b/imperative/python/test/unit/random/test_rng.py index 59ec355f..3dd89b20 100644 --- a/imperative/python/test/unit/random/test_rng.py +++ b/imperative/python/test/unit/random/test_rng.py @@ -39,6 +39,8 @@ from megengine.random import uniform get_device_count("xpu") <= 2, reason="xpu counts need > 2", ) def test_gaussian_op(): + # FIXME: remove this sync + mge.core.set_option("async_level", 0) set_global_seed(1024) shape = ( 8, @@ -210,12 +212,9 @@ def test_permutation_op(): assert str(output.device) == str(cn) assert output.dtype == dtype - # FIXME: remove this sync - mge.core.set_option("async_level", 0) test_permutation_op_dtype(np.float32) test_permutation_op_dtype(np.int32) test_permutation_op_dtype(np.int16) - mge.core.set_option("async_level", 2) @pytest.mark.skipif( @@ -517,3 +516,4 @@ def test_rng_empty_tensor(is_symbolic): np.testing.assert_equal(out.numpy().shape, (0,)) if is_symbolic is None: break + mge.core.set_option("async_level", 2)