Browse Source

gpu testcase fix

tags/v1.2.0-rc1
wilfChen 4 years ago
parent
commit
2e7d7b1c5e
2 changed files with 7 additions and 1 deletions
  1. +1
    -1
      tests/st/ops/gpu/test_adam_fusion.py
  2. +6
    -0
      tests/st/ops/gpu/test_layer_norm_op.py

+ 1
- 1
tests/st/ops/gpu/test_adam_fusion.py View File

@@ -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))


+ 6
- 0
tests/st/ops/gpu/test_layer_norm_op.py View File

@@ -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)


Loading…
Cancel
Save