From 2e7d7b1c5e6a4e708b6d1ce9a7d923f34f54ebcf Mon Sep 17 00:00:00 2001 From: wilfChen Date: Thu, 28 Jan 2021 20:08:39 +0800 Subject: [PATCH] gpu testcase fix --- tests/st/ops/gpu/test_adam_fusion.py | 2 +- tests/st/ops/gpu/test_layer_norm_op.py | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/st/ops/gpu/test_adam_fusion.py b/tests/st/ops/gpu/test_adam_fusion.py index f0595d12a1..32154afba4 100644 --- a/tests/st/ops/gpu/test_adam_fusion.py +++ b/tests/st/ops/gpu/test_adam_fusion.py @@ -68,7 +68,7 @@ class Net(nn.Cell): @pytest.mark.level0 @pytest.mark.platform_x86_gpu_training @pytest.mark.env_onecard -def test(): +def test_adam_fusion(): beta1 = Tensor(np.array([0.9]).astype(np.float32)) beta2 = Tensor(np.array([0.999]).astype(np.float32)) lr = Tensor(np.array([0.001]).astype(np.float32)) diff --git a/tests/st/ops/gpu/test_layer_norm_op.py b/tests/st/ops/gpu/test_layer_norm_op.py index 040bc2c1bc..6aa5f67d6e 100644 --- a/tests/st/ops/gpu/test_layer_norm_op.py +++ b/tests/st/ops/gpu/test_layer_norm_op.py @@ -53,6 +53,7 @@ def LayerNormReference(begin_norm_axis, begin_params_axis, x, gamma, beta): def test_layernorm0(): begin_norm_axis = 1 begin_params_axis = 1 + np.random.seed(42) x_np = np.random.randn(4096, 3072).astype(np.float32) gamma_np = np.random.randn(*x_np.shape[begin_params_axis:]).astype(np.float32) beta_np = np.random.randn(*x_np.shape[begin_params_axis:]).astype(np.float32) @@ -75,6 +76,7 @@ def test_layernorm0(): def test_layernorm1(): begin_norm_axis = 1 begin_params_axis = 1 + np.random.seed(42) x_np = np.random.randn(640, 768).astype(np.float32) gamma_np = np.random.randn(*x_np.shape[begin_params_axis:]).astype(np.float32) beta_np = np.random.randn(*x_np.shape[begin_params_axis:]).astype(np.float32) @@ -97,6 +99,7 @@ def test_layernorm1(): def test_layernorm3d_1(): begin_norm_axis = -1 begin_params_axis = -1 + np.random.seed(42) x_np = np.random.randn(32, 128, 768).astype(np.float32) gamma_np = np.random.randn(*x_np.shape[begin_params_axis:]).astype(np.float32) beta_np = np.random.randn(*x_np.shape[begin_params_axis:]).astype(np.float32) @@ -119,6 +122,7 @@ def test_layernorm3d_1(): def test_layernorm3d_2(): begin_norm_axis = -1 begin_params_axis = 1 + np.random.seed(42) x_np = np.random.randn(32, 128, 768).astype(np.float32) gamma_np = np.random.randn(*x_np.shape[begin_params_axis:]).astype(np.float32) beta_np = np.random.randn(*x_np.shape[begin_params_axis:]).astype(np.float32) @@ -141,6 +145,7 @@ def test_layernorm3d_2(): def test_layernorm2d_2(): begin_norm_axis = -1 begin_params_axis = 1 + np.random.seed(42) x_np = np.random.randn(64, 32).astype(np.float32) gamma_np = np.random.randn(*x_np.shape[begin_params_axis:]).astype(np.float32) beta_np = np.random.randn(*x_np.shape[begin_params_axis:]).astype(np.float32) @@ -162,6 +167,7 @@ def test_layernorm2d_2(): def test_layernorm2d_3(): begin_norm_axis = -1 begin_params_axis = 1 + np.random.seed(42) x_np = np.random.randn(128, 128).astype(np.float32) gamma_np = np.random.randn(*x_np.shape[begin_params_axis:]).astype(np.float32) beta_np = np.random.randn(*x_np.shape[begin_params_axis:]).astype(np.float32)