From b7ad898ce2f16b2c9a3231f56779408ee8ae8a90 Mon Sep 17 00:00:00 2001 From: huangbo77 Date: Tue, 20 Jul 2021 10:24:06 +0800 Subject: [PATCH] fixed decorators in cpu tests --- .../cpu/mirror_pad_cpu_kernel.cc | 4 +--- .../cpu/mirror_pad_cpu_kernel.h | 14 +++++++++++ .../cpu/mirror_pad_grad_cpu_kernel.h | 15 ++++++++++++ mindspore/nn/layer/basic.py | 2 +- mindspore/ops/_op_impl/cpu/mirror_pad.py | 3 +++ mindspore/ops/_op_impl/cpu/mirror_pad_grad.py | 3 +++ tests/st/ops/cpu/test_arithmetic_op.py | 8 +++---- tests/st/ops/cpu/test_broadcast_to_op.py | 6 ++--- tests/st/ops/cpu/test_depthtospace_op.py | 20 ++++++++-------- tests/st/ops/cpu/test_isfinite_op.py | 2 +- tests/st/ops/cpu/test_isnan_op.py | 2 +- tests/st/ops/cpu/test_l2normalize_grad_op.py | 2 +- tests/st/ops/cpu/test_l2normalize_op.py | 8 +++---- tests/st/ops/cpu/test_less_equal_op.py | 12 +++++----- tests/st/ops/cpu/test_less_op.py | 2 +- tests/st/ops/cpu/test_maximum_grad.py | 4 ++-- tests/st/ops/cpu/test_maximum_op.py | 14 +++++------ tests/st/ops/cpu/test_mirror_pad.py | 8 +++---- tests/st/ops/cpu/test_norm_op.py | 2 +- tests/st/ops/cpu/test_one_hot_op.py | 2 +- tests/st/ops/cpu/test_oneslike_op.py | 2 +- tests/st/ops/cpu/test_pad.py | 12 +++++----- tests/st/ops/cpu/test_pow_op.py | 2 +- tests/st/ops/cpu/test_realdiv_op.py | 2 +- tests/st/ops/cpu/test_rmsprop.py | 4 ++-- tests/st/ops/cpu/test_spacetodepth_op.py | 20 ++++++++-------- .../st/ops/cpu/test_squared_difference_op.py | 4 ++-- tests/st/ops/cpu/test_unpack_op.py | 24 +++++++++---------- tests/st/ops/cpu/test_zeroslike_op.py | 2 +- 29 files changed, 119 insertions(+), 86 deletions(-) diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/mirror_pad_cpu_kernel.cc b/mindspore/ccsrc/backend/kernel_compiler/cpu/mirror_pad_cpu_kernel.cc index 105c762d7f3..622f3bb6dce 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/mirror_pad_cpu_kernel.cc +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/mirror_pad_cpu_kernel.cc @@ -20,6 +20,7 @@ namespace mindspore { namespace kernel { void MirrorPadCPUKernel::InitKernel(const CNodePtr &kernel_node) { + CheckParam(kernel_node); std::string mode = AnfAlgo::GetNodeAttr(kernel_node, "mode"); dtype_ = AnfAlgo::GetInputDeviceDataType(kernel_node, 0); if (mode == "REFLECT") { @@ -47,7 +48,6 @@ void MirrorPadCPUKernel::InitKernel(const CNodePtr &kernel_node) { tensor_size_ *= input_shape[i]; input_shape_.push_back(SizeToLong(input_shape[i])); } - std::vector padding_shape = AnfAlgo::GetPrevNodeOutputInferShape(kernel_node, 1); num_paddings_ = SizeToLong(padding_shape[0]); @@ -59,7 +59,6 @@ void MirrorPadCPUKernel::InitKernel(const CNodePtr &kernel_node) { int64_t max_width = input_shape_[3]; int64_t max_height = input_shape_[2]; - if (mode_ == 1) { // symmetric max_width = max_width + (2 * max_width); max_height = max_height + (2 * max_height); @@ -110,7 +109,6 @@ void MirrorPadCPUKernel::LaunchKernel(const std::vector &inputs, con const int64_t padded_height = output_shape_[dim_offset]; const int64_t padded_width = output_shape_[dim_offset + 1]; const int64_t padd_dim = num_paddings_; - const int64_t mode = mode_; int64_t paddings[MAX_PADDINGS * PADDING_SIZE]; // local and fixed size to keep in registers diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/mirror_pad_cpu_kernel.h b/mindspore/ccsrc/backend/kernel_compiler/cpu/mirror_pad_cpu_kernel.h index 01ce6e0dbe3..c0a13bc6365 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/mirror_pad_cpu_kernel.h +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/mirror_pad_cpu_kernel.h @@ -77,6 +77,20 @@ MS_REG_CPU_KERNEL( MS_REG_CPU_KERNEL( MirrorPad, KernelAttr().AddInputAttr(kNumberTypeInt32).AddInputAttr(kNumberTypeInt64).AddOutputAttr(kNumberTypeInt32), MirrorPadCPUKernel); + +MS_REG_CPU_KERNEL( + MirrorPad, + KernelAttr().AddInputAttr(kNumberTypeFloat16).AddInputAttr(kNumberTypeInt32).AddOutputAttr(kNumberTypeFloat16), + MirrorPadCPUKernel); + +MS_REG_CPU_KERNEL( + MirrorPad, + KernelAttr().AddInputAttr(kNumberTypeFloat32).AddInputAttr(kNumberTypeInt32).AddOutputAttr(kNumberTypeFloat32), + MirrorPadCPUKernel); + +MS_REG_CPU_KERNEL( + MirrorPad, KernelAttr().AddInputAttr(kNumberTypeInt32).AddInputAttr(kNumberTypeInt32).AddOutputAttr(kNumberTypeInt32), + MirrorPadCPUKernel); } // namespace kernel } // namespace mindspore #endif // MINDSPORE_CCSRC_BACKEND_KERNEL_COMPILER_CPU_MIRROR_PAD_CPU_KERNEL_H_ diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/mirror_pad_grad_cpu_kernel.h b/mindspore/ccsrc/backend/kernel_compiler/cpu/mirror_pad_grad_cpu_kernel.h index 30ddcc2aab9..57eff40b55c 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/mirror_pad_grad_cpu_kernel.h +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/mirror_pad_grad_cpu_kernel.h @@ -94,6 +94,21 @@ MS_REG_CPU_KERNEL( MirrorPadGrad, KernelAttr().AddInputAttr(kNumberTypeInt32).AddInputAttr(kNumberTypeInt64).AddOutputAttr(kNumberTypeInt32), MirrorPadGradCPUKernel); + +MS_REG_CPU_KERNEL( + MirrorPadGrad, + KernelAttr().AddInputAttr(kNumberTypeFloat16).AddInputAttr(kNumberTypeInt32).AddOutputAttr(kNumberTypeFloat16), + MirrorPadGradCPUKernel); + +MS_REG_CPU_KERNEL( + MirrorPadGrad, + KernelAttr().AddInputAttr(kNumberTypeFloat32).AddInputAttr(kNumberTypeInt32).AddOutputAttr(kNumberTypeFloat32), + MirrorPadGradCPUKernel); + +MS_REG_CPU_KERNEL( + MirrorPadGrad, + KernelAttr().AddInputAttr(kNumberTypeInt32).AddInputAttr(kNumberTypeInt32).AddOutputAttr(kNumberTypeInt32), + MirrorPadGradCPUKernel); } // namespace kernel } // namespace mindspore #endif // MINDSPORE_CCSRC_BACKEND_KERNEL_COMPILER_CPU_MIRROR_PAD_CPU_KERNEL_H_ diff --git a/mindspore/nn/layer/basic.py b/mindspore/nn/layer/basic.py index 072616be7b1..848e486dee3 100644 --- a/mindspore/nn/layer/basic.py +++ b/mindspore/nn/layer/basic.py @@ -801,7 +801,7 @@ class Pad(Cell): if mode == "CONSTANT": self.pad = P.Pad(self.paddings) else: - self.paddings = Tensor(np.array(self.paddings)) + self.paddings = Tensor(np.array(self.paddings), dtype=mstype.int64) self.pad = P.MirrorPad(mode=mode) def construct(self, x): diff --git a/mindspore/ops/_op_impl/cpu/mirror_pad.py b/mindspore/ops/_op_impl/cpu/mirror_pad.py index 41ca2325446..9ab0a4f65ea 100644 --- a/mindspore/ops/_op_impl/cpu/mirror_pad.py +++ b/mindspore/ops/_op_impl/cpu/mirror_pad.py @@ -22,6 +22,9 @@ mirror_pad_op_info = CpuRegOp("MirrorPad") \ .dtype_format(DataType.F16_Default, DataType.I64_Default, DataType.F16_Default) \ .dtype_format(DataType.F32_Default, DataType.I64_Default, DataType.F32_Default) \ .dtype_format(DataType.I32_Default, DataType.I64_Default, DataType.I32_Default) \ + .dtype_format(DataType.F16_Default, DataType.I32_Default, DataType.F16_Default) \ + .dtype_format(DataType.F32_Default, DataType.I32_Default, DataType.F32_Default) \ + .dtype_format(DataType.I32_Default, DataType.I32_Default, DataType.I32_Default) \ .get_op_info() diff --git a/mindspore/ops/_op_impl/cpu/mirror_pad_grad.py b/mindspore/ops/_op_impl/cpu/mirror_pad_grad.py index 05bb82cfe70..6bd0c88025a 100644 --- a/mindspore/ops/_op_impl/cpu/mirror_pad_grad.py +++ b/mindspore/ops/_op_impl/cpu/mirror_pad_grad.py @@ -22,6 +22,9 @@ mirror_pad_grad_op_info = CpuRegOp("MirrorPadGrad") \ .dtype_format(DataType.F16_Default, DataType.I64_Default, DataType.F16_Default) \ .dtype_format(DataType.F32_Default, DataType.I64_Default, DataType.F32_Default) \ .dtype_format(DataType.I32_Default, DataType.I64_Default, DataType.I32_Default) \ + .dtype_format(DataType.F16_Default, DataType.I32_Default, DataType.F16_Default) \ + .dtype_format(DataType.F32_Default, DataType.I32_Default, DataType.F32_Default) \ + .dtype_format(DataType.I32_Default, DataType.I32_Default, DataType.I32_Default) \ .get_op_info() diff --git a/tests/st/ops/cpu/test_arithmetic_op.py b/tests/st/ops/cpu/test_arithmetic_op.py index ad0d587b49e..1718c1a6532 100644 --- a/tests/st/ops/cpu/test_arithmetic_op.py +++ b/tests/st/ops/cpu/test_arithmetic_op.py @@ -82,7 +82,7 @@ def test_sub(): @pytest.mark.level0 -@pytest.mark.platform_x86_cpu_training +@pytest.mark.platform_x86_cpu @pytest.mark.env_onecard def test_div(): prop = 1 if np.random.random() < 0.5 else -1 @@ -175,7 +175,7 @@ def test_div(): @pytest.mark.level0 -@pytest.mark.platform_x86_cpu_training +@pytest.mark.platform_x86_cpu @pytest.mark.env_onecard def test_floor_div(): prop = 1 if np.random.random() < 0.5 else -1 @@ -240,7 +240,7 @@ def test_floor_div(): @pytest.mark.level0 -@pytest.mark.platform_x86_cpu_training +@pytest.mark.platform_x86_cpu @pytest.mark.env_onecard def test_mod(): prop = 1 if np.random.random() < 0.5 else -1 @@ -334,7 +334,7 @@ def test_mod(): @pytest.mark.level0 -@pytest.mark.platform_x86_cpu_training +@pytest.mark.platform_x86_cpu @pytest.mark.env_onecard def test_floor_mod(): prop = 1 if np.random.random() < 0.5 else -1 diff --git a/tests/st/ops/cpu/test_broadcast_to_op.py b/tests/st/ops/cpu/test_broadcast_to_op.py index d4e0b67ee0e..f70bba66989 100644 --- a/tests/st/ops/cpu/test_broadcast_to_op.py +++ b/tests/st/ops/cpu/test_broadcast_to_op.py @@ -22,7 +22,7 @@ from mindspore.ops import operations as P @pytest.mark.level0 -@pytest.mark.platform_x86_gpu_training +@pytest.mark.platform_x86_cpu @pytest.mark.env_onecard def test_broadcast(): context.set_context(mode=context.GRAPH_MODE, device_target='CPU') @@ -76,7 +76,7 @@ def test_broadcast(): @pytest.mark.level0 -@pytest.mark.platform_x86_gpu_training +@pytest.mark.platform_x86_cpu @pytest.mark.env_onecard def test_broadcast_dyn_init(): """ @@ -105,7 +105,7 @@ def test_broadcast_dyn_init(): @pytest.mark.level0 -@pytest.mark.platform_x86_gpu_training +@pytest.mark.platform_x86_cpu @pytest.mark.env_onecard def test_broadcast_dyn_invalid_init(): """ diff --git a/tests/st/ops/cpu/test_depthtospace_op.py b/tests/st/ops/cpu/test_depthtospace_op.py index a790152f1ce..42557a87d90 100644 --- a/tests/st/ops/cpu/test_depthtospace_op.py +++ b/tests/st/ops/cpu/test_depthtospace_op.py @@ -55,61 +55,61 @@ def DepthToSpace(nptype, block_size=2, input_shape=(1, 12, 1, 1)): assert (output.asnumpy() == expect).all() @pytest.mark.level0 -@pytest.mark.platform_x86_gpu_training +@pytest.mark.platform_x86_cpu @pytest.mark.env_onecard def test_depthtospace_graph_float32(): DepthToSpace(np.float32) @pytest.mark.level0 -@pytest.mark.platform_x86_gpu_training +@pytest.mark.platform_x86_cpu @pytest.mark.env_onecard def test_depthtospace_graph_float16(): DepthToSpace(np.float16) @pytest.mark.level0 -@pytest.mark.platform_x86_gpu_training +@pytest.mark.platform_x86_cpu @pytest.mark.env_onecard def test_depthtospace_graph_int32(): DepthToSpace(np.int32) @pytest.mark.level0 -@pytest.mark.platform_x86_gpu_training +@pytest.mark.platform_x86_cpu @pytest.mark.env_onecard def test_depthtospace_graph_int64(): DepthToSpace(np.int64) @pytest.mark.level0 -@pytest.mark.platform_x86_gpu_training +@pytest.mark.platform_x86_cpu @pytest.mark.env_onecard def test_depthtospace_graph_int8(): DepthToSpace(np.int8) @pytest.mark.level0 -@pytest.mark.platform_x86_gpu_training +@pytest.mark.platform_x86_cpu @pytest.mark.env_onecard def test_depthtospace_graph_int16(): DepthToSpace(np.int16) @pytest.mark.level0 -@pytest.mark.platform_x86_gpu_training +@pytest.mark.platform_x86_cpu @pytest.mark.env_onecard def test_depthtospace_graph_uint8(): DepthToSpace(np.uint8) @pytest.mark.level0 -@pytest.mark.platform_x86_gpu_training +@pytest.mark.platform_x86_cpu @pytest.mark.env_onecard def test_depthtospace_graph_uint16(): DepthToSpace(np.uint16) @pytest.mark.level0 -@pytest.mark.platform_x86_gpu_training +@pytest.mark.platform_x86_cpu @pytest.mark.env_onecard def test_depthtospace_graph_uint32(): DepthToSpace(np.uint32) @pytest.mark.level0 -@pytest.mark.platform_x86_gpu_training +@pytest.mark.platform_x86_cpu @pytest.mark.env_onecard def test_depthtospace_graph_uint64(): DepthToSpace(np.uint64) diff --git a/tests/st/ops/cpu/test_isfinite_op.py b/tests/st/ops/cpu/test_isfinite_op.py index 2a7aee9fa36..cfbf6714551 100644 --- a/tests/st/ops/cpu/test_isfinite_op.py +++ b/tests/st/ops/cpu/test_isfinite_op.py @@ -34,7 +34,7 @@ class Net(nn.Cell): @pytest.mark.level0 -@pytest.mark.platform_x86_cpu_training +@pytest.mark.platform_x86_cpu @pytest.mark.env_onecard def test_net(): x0 = Tensor(np.array([np.log(-1), 0.4, np.log(0)]).astype(np.float16)) diff --git a/tests/st/ops/cpu/test_isnan_op.py b/tests/st/ops/cpu/test_isnan_op.py index 10630efedc3..f3e6ce10e4d 100644 --- a/tests/st/ops/cpu/test_isnan_op.py +++ b/tests/st/ops/cpu/test_isnan_op.py @@ -39,7 +39,7 @@ x3 = np.array([[1, 2], [3, 4], [5.0, 88.0]]).astype(np.float32) @pytest.mark.level0 -@pytest.mark.platform_x86_cpu_training +@pytest.mark.platform_x86_cpu @pytest.mark.env_onecard def test_nan(): ms_isnan = Netnan() diff --git a/tests/st/ops/cpu/test_l2normalize_grad_op.py b/tests/st/ops/cpu/test_l2normalize_grad_op.py index 70aba3b5c93..f6c8d2d85ce 100644 --- a/tests/st/ops/cpu/test_l2normalize_grad_op.py +++ b/tests/st/ops/cpu/test_l2normalize_grad_op.py @@ -33,7 +33,7 @@ class Net(nn.Cell): @pytest.mark.level0 -@pytest.mark.platform_x86_cpu_training +@pytest.mark.platform_x86_cpu @pytest.mark.env_onecard def test_net01(): context.set_context(mode=context.GRAPH_MODE, device_target='CPU') diff --git a/tests/st/ops/cpu/test_l2normalize_op.py b/tests/st/ops/cpu/test_l2normalize_op.py index fc05a5cc2fc..bf68ba896c6 100644 --- a/tests/st/ops/cpu/test_l2normalize_op.py +++ b/tests/st/ops/cpu/test_l2normalize_op.py @@ -34,7 +34,7 @@ class Net(Cell): @pytest.mark.level0 -@pytest.mark.platform_x86_cpu_training +@pytest.mark.platform_x86_cpu @pytest.mark.env_onecard def test_l2normalize_float32(): x = np.arange(20*20*20*20).astype(np.float32).reshape(20, 20, 20, 20) @@ -50,7 +50,7 @@ def test_l2normalize_float32(): @pytest.mark.level0 -@pytest.mark.platform_x86_cpu_training +@pytest.mark.platform_x86_cpu @pytest.mark.env_onecard def test_l2normalize_float16(): x = np.arange(96).astype(np.float16).reshape(2, 3, 4, 4) @@ -66,7 +66,7 @@ def test_l2normalize_float16(): @pytest.mark.level0 -@pytest.mark.platform_x86_cpu_training +@pytest.mark.platform_x86_cpu @pytest.mark.env_onecard def test_l2normalize_axis(): axis = -2 @@ -83,7 +83,7 @@ def test_l2normalize_axis(): @pytest.mark.level0 -@pytest.mark.platform_x86_cpu_training +@pytest.mark.platform_x86_cpu @pytest.mark.env_onecard def test_l2normalize_epsilon(): axis = -1 diff --git a/tests/st/ops/cpu/test_less_equal_op.py b/tests/st/ops/cpu/test_less_equal_op.py index 079a63a4001..a5e056da216 100644 --- a/tests/st/ops/cpu/test_less_equal_op.py +++ b/tests/st/ops/cpu/test_less_equal_op.py @@ -30,7 +30,7 @@ class Net(nn.Cell): @pytest.mark.level0 -@pytest.mark.platform_x86_cpu_training +@pytest.mark.platform_x86_cpu @pytest.mark.env_onecard def test_net_fp32(): x0_np = np.random.randint(1, 5, (2, 3, 4, 4)).astype(np.float32) @@ -84,7 +84,7 @@ def test_net_fp32(): @pytest.mark.level0 -@pytest.mark.platform_x86_cpu_training +@pytest.mark.platform_x86_cpu @pytest.mark.env_onecard def test_net_fp16(): x0_np = np.random.randint(1, 5, (2, 3, 4, 4)).astype(np.float16) @@ -138,7 +138,7 @@ def test_net_fp16(): @pytest.mark.level0 -@pytest.mark.platform_x86_cpu_training +@pytest.mark.platform_x86_cpu @pytest.mark.env_onecard def test_net_int32(): x1_np = np.random.randint(1, 5, (2, 3, 4, 4)).astype(np.int32) @@ -156,7 +156,7 @@ def test_net_int32(): @pytest.mark.level0 -@pytest.mark.platform_x86_cpu_training +@pytest.mark.platform_x86_cpu @pytest.mark.env_onecard def test_net_int64(): x1_np = np.random.randint(1, 5, (2, 3, 4, 4)).astype(np.int64) @@ -174,7 +174,7 @@ def test_net_int64(): @pytest.mark.level0 -@pytest.mark.platform_x86_cpu_training +@pytest.mark.platform_x86_cpu @pytest.mark.env_onecard def test_net_float64(): x1_np = np.random.randint(1, 5, (2, 3, 4, 4)).astype(np.float64) @@ -192,7 +192,7 @@ def test_net_float64(): @pytest.mark.level0 -@pytest.mark.platform_x86_cpu_training +@pytest.mark.platform_x86_cpu @pytest.mark.env_onecard def test_net_int16(): x1_np = np.random.randint(1, 5, (2, 3, 4, 4)).astype(np.int16) diff --git a/tests/st/ops/cpu/test_less_op.py b/tests/st/ops/cpu/test_less_op.py index 4195bd4ab20..5310dd388b3 100644 --- a/tests/st/ops/cpu/test_less_op.py +++ b/tests/st/ops/cpu/test_less_op.py @@ -30,7 +30,7 @@ class Net(nn.Cell): @pytest.mark.level0 -@pytest.mark.platform_x86_cpu_training +@pytest.mark.platform_x86_cpu @pytest.mark.env_onecard def test_net(): x0_np = np.random.randint(1, 5, (2, 3, 4, 4)).astype(np.float32) diff --git a/tests/st/ops/cpu/test_maximum_grad.py b/tests/st/ops/cpu/test_maximum_grad.py index 1b06024aa88..53ac72b5977 100644 --- a/tests/st/ops/cpu/test_maximum_grad.py +++ b/tests/st/ops/cpu/test_maximum_grad.py @@ -33,7 +33,7 @@ class MaxmumGradNet(Cell): @pytest.mark.level0 -@pytest.mark.platform_x86_cpu_training +@pytest.mark.platform_x86_cpu @pytest.mark.env_onecard def test_maximum_grad_random(): np.random.seed(0) @@ -49,7 +49,7 @@ def test_maximum_grad_random(): @pytest.mark.level0 -@pytest.mark.platform_x86_cpu_training +@pytest.mark.platform_x86_cpu @pytest.mark.env_onecard def test_broadcast_grad_cpu(): x = np.array([[[[0.659578], diff --git a/tests/st/ops/cpu/test_maximum_op.py b/tests/st/ops/cpu/test_maximum_op.py index a18676e3b9d..e52969287f7 100644 --- a/tests/st/ops/cpu/test_maximum_op.py +++ b/tests/st/ops/cpu/test_maximum_op.py @@ -42,7 +42,7 @@ class TwoTensorsMaximum(Cell): @pytest.mark.level0 -@pytest.mark.platform_x86_cpu_training +@pytest.mark.platform_x86_cpu @pytest.mark.env_onecard def test_maximum_constScalar_tensor_int(): x = Tensor(np.array([[2, 3, 4], [100, 200, 300]]).astype(np.int32)) @@ -58,7 +58,7 @@ def test_maximum_constScalar_tensor_int(): @pytest.mark.level0 -@pytest.mark.platform_x86_cpu_training +@pytest.mark.platform_x86_cpu @pytest.mark.env_onecard def test_maximum_two_tensors_Not_Broadcast_int(): x = Tensor(np.array([[2, 3, 4], [100, 200, 300]]).astype(np.int32)) @@ -75,7 +75,7 @@ def test_maximum_two_tensors_Not_Broadcast_int(): @pytest.mark.level0 -@pytest.mark.platform_x86_cpu_training +@pytest.mark.platform_x86_cpu @pytest.mark.env_onecard def test_maximum_two_tensors_Broadcast_int(): x = Tensor(np.array([[2, 3, 4], [100, 200, 300]]).astype(np.int32)) @@ -92,7 +92,7 @@ def test_maximum_two_tensors_Broadcast_int(): @pytest.mark.level0 -@pytest.mark.platform_x86_cpu_training +@pytest.mark.platform_x86_cpu @pytest.mark.env_onecard def test_maximum_two_tensors_Broadcast_oneDimension_int(): x = Tensor(np.array([[2, 3, 4], [100, 200, 300]]).astype(np.int32)) @@ -109,7 +109,7 @@ def test_maximum_two_tensors_Broadcast_oneDimension_int(): @pytest.mark.level0 -@pytest.mark.platform_x86_cpu_training +@pytest.mark.platform_x86_cpu @pytest.mark.env_onecard def test_maximum_two_tensors_notBroadcast_all_oneDimension_int(): x = Tensor(np.array([[2]]).astype(np.int32)) @@ -126,7 +126,7 @@ def test_maximum_two_tensors_notBroadcast_all_oneDimension_int(): @pytest.mark.level0 -@pytest.mark.platform_x86_cpu_training +@pytest.mark.platform_x86_cpu @pytest.mark.env_onecard def test_maximum_two_tensors_notBroadcast_float32(): x = Tensor(np.array([[2.0, 2.0], [-1, 100]]).astype(np.float32)) @@ -143,7 +143,7 @@ def test_maximum_two_tensors_notBroadcast_float32(): @pytest.mark.level0 -@pytest.mark.platform_x86_cpu_training +@pytest.mark.platform_x86_cpu @pytest.mark.env_onecard def test_maximum_two_tensors_notBroadcast_float64(): x = Tensor(np.array([[2.0, 2.0], [-1, 100]]).astype(np.float64)) diff --git a/tests/st/ops/cpu/test_mirror_pad.py b/tests/st/ops/cpu/test_mirror_pad.py index 762e2c04749..d5982ef90f1 100644 --- a/tests/st/ops/cpu/test_mirror_pad.py +++ b/tests/st/ops/cpu/test_mirror_pad.py @@ -24,7 +24,7 @@ from mindspore import Tensor from mindspore.ops.composite import GradOperation @pytest.mark.level0 -@pytest.mark.platform_x86_cpu_training +@pytest.mark.platform_x86_cpu @pytest.mark.env_onecard def test_mirror_pad(): context.set_context(mode=context.GRAPH_MODE, device_target="CPU") @@ -72,7 +72,7 @@ class Net(nn.Cell): @pytest.mark.level0 -@pytest.mark.platform_x86_cpu_training +@pytest.mark.platform_x86_cpu @pytest.mark.env_onecard def test_mirror_pad_backprop(): context.set_context(mode=context.GRAPH_MODE, device_target="CPU") @@ -88,7 +88,7 @@ def test_mirror_pad_backprop(): np.testing.assert_array_almost_equal(dx, expected_dx) @pytest.mark.level0 -@pytest.mark.platform_x86_gpu_training +@pytest.mark.platform_x86_cpu @pytest.mark.env_onecard def test_mirror_pad_fwd_back_4d_int32_reflect(): context.set_context(mode=context.GRAPH_MODE, device_target="CPU") @@ -129,7 +129,7 @@ def test_mirror_pad_fwd_back_4d_int32_reflect(): @pytest.mark.level0 -@pytest.mark.platform_x86_cpu_training +@pytest.mark.platform_x86_cpu @pytest.mark.env_onecard def test_mirror_pad_fwd_back_4d_int32_symm(): context.set_context(mode=context.GRAPH_MODE, device_target="CPU") diff --git a/tests/st/ops/cpu/test_norm_op.py b/tests/st/ops/cpu/test_norm_op.py index 5eedca71190..cc14a9d72a7 100644 --- a/tests/st/ops/cpu/test_norm_op.py +++ b/tests/st/ops/cpu/test_norm_op.py @@ -41,7 +41,7 @@ class NetNorm(nn.Cell): self.norm_4(indices)) @pytest.mark.level0 -@pytest.mark.platform_x86_gpu_training +@pytest.mark.platform_x86_cpu @pytest.mark.env_onecard def test_norm(): norm = NetNorm() diff --git a/tests/st/ops/cpu/test_one_hot_op.py b/tests/st/ops/cpu/test_one_hot_op.py index 77d5ea3436e..dcac439e9b1 100644 --- a/tests/st/ops/cpu/test_one_hot_op.py +++ b/tests/st/ops/cpu/test_one_hot_op.py @@ -45,7 +45,7 @@ class NetOneHot(nn.Cell): @pytest.mark.level0 -@pytest.mark.platform_x86_gpu_training +@pytest.mark.platform_x86_cpu @pytest.mark.env_onecard def test_one_hot(): one_hot = NetOneHot() diff --git a/tests/st/ops/cpu/test_oneslike_op.py b/tests/st/ops/cpu/test_oneslike_op.py index f16dd1c1d46..191f1532039 100644 --- a/tests/st/ops/cpu/test_oneslike_op.py +++ b/tests/st/ops/cpu/test_oneslike_op.py @@ -32,7 +32,7 @@ class NetOnesLike(nn.Cell): @pytest.mark.level0 -@pytest.mark.platform_x86_cpu_training +@pytest.mark.platform_x86_cpu @pytest.mark.env_onecard def test_OnesLike(): x0_np = np.random.uniform(-2, 2, (2, 3, 4, 4)).astype(np.float32) diff --git a/tests/st/ops/cpu/test_pad.py b/tests/st/ops/cpu/test_pad.py index cc0be8d583f..09be2b553d7 100644 --- a/tests/st/ops/cpu/test_pad.py +++ b/tests/st/ops/cpu/test_pad.py @@ -25,7 +25,7 @@ from mindspore.ops.composite import GradOperation @pytest.mark.level0 -@pytest.mark.platform_x86_cpu_training +@pytest.mark.platform_x86_cpu @pytest.mark.env_onecard def test_pad_basic(): """ @@ -53,7 +53,7 @@ def test_pad_basic(): @pytest.mark.level0 -@pytest.mark.platform_x86_cpu_training +@pytest.mark.platform_x86_cpu @pytest.mark.env_onecard def test_pad_row(): """ @@ -84,7 +84,7 @@ def test_pad_row(): @pytest.mark.level0 -@pytest.mark.platform_x86_cpu_training +@pytest.mark.platform_x86_cpu @pytest.mark.env_onecard def test_pad_column(): """ @@ -115,7 +115,7 @@ def test_pad_column(): @pytest.mark.level0 -@pytest.mark.platform_x86_cpu_training +@pytest.mark.platform_x86_cpu @pytest.mark.env_onecard def test_pad_3d_pad(): """ @@ -173,7 +173,7 @@ class Net(nn.Cell): @pytest.mark.level0 -@pytest.mark.platform_x86_cpu_training +@pytest.mark.platform_x86_cpu @pytest.mark.env_onecard def test_pad_3d_backprop(): """ @@ -212,7 +212,7 @@ def test_pad_3d_backprop(): @pytest.mark.level0 -@pytest.mark.platform_x86_cpu_training +@pytest.mark.platform_x86_cpu @pytest.mark.env_onecard def test_pad_error_cases(): context.set_context(mode=context.GRAPH_MODE, device_target="CPU") diff --git a/tests/st/ops/cpu/test_pow_op.py b/tests/st/ops/cpu/test_pow_op.py index 998b254f5d3..ae68cf8aae1 100644 --- a/tests/st/ops/cpu/test_pow_op.py +++ b/tests/st/ops/cpu/test_pow_op.py @@ -32,7 +32,7 @@ class Net(nn.Cell): @pytest.mark.level0 -@pytest.mark.platform_x86_cpu_training +@pytest.mark.platform_x86_cpu @pytest.mark.env_onecard def test_net(): x0_np = np.random.randint(1, 5, (2, 3, 4, 4)).astype(np.float32) diff --git a/tests/st/ops/cpu/test_realdiv_op.py b/tests/st/ops/cpu/test_realdiv_op.py index 52c5d651e65..37d266e8caf 100644 --- a/tests/st/ops/cpu/test_realdiv_op.py +++ b/tests/st/ops/cpu/test_realdiv_op.py @@ -32,7 +32,7 @@ class NetRealDiv(nn.Cell): @pytest.mark.level0 -@pytest.mark.platform_x86_cpu_training +@pytest.mark.platform_x86_cpu @pytest.mark.env_onecard def test_real_div(): x0_np = np.random.randint(1, 5, (2, 3, 4, 4)).astype(np.float32) diff --git a/tests/st/ops/cpu/test_rmsprop.py b/tests/st/ops/cpu/test_rmsprop.py index 4121d46071f..5a40a3b95d7 100644 --- a/tests/st/ops/cpu/test_rmsprop.py +++ b/tests/st/ops/cpu/test_rmsprop.py @@ -82,7 +82,7 @@ def rmspropcented_numpy(variable, gradients, mean_gradients, mean_square, moment @pytest.mark.level0 -@pytest.mark.platform_cpu_training +@pytest.mark.platform_cpu @pytest.mark.env_onecard def test_rmsprop(): learning_rate, decay, momentum, epsilon, centered = [0.5, 0.8, 0.9, 1e-3, True] @@ -143,7 +143,7 @@ def test_rmsprop(): @pytest.mark.level0 -@pytest.mark.platform_cpu_training +@pytest.mark.platform_cpu @pytest.mark.env_onecard def test_rmspropcenter(): learning_rate, decay, momentum, epsilon, centered = [0.1, 0.3, 0.9, 1.0, False] diff --git a/tests/st/ops/cpu/test_spacetodepth_op.py b/tests/st/ops/cpu/test_spacetodepth_op.py index 865cc4fd575..704fd185d27 100644 --- a/tests/st/ops/cpu/test_spacetodepth_op.py +++ b/tests/st/ops/cpu/test_spacetodepth_op.py @@ -49,61 +49,61 @@ def SpaceToDepth(nptype): assert (output.asnumpy() == expect).all() @pytest.mark.level0 -@pytest.mark.platform_x86_gpu_training +@pytest.mark.platform_x86_cpu @pytest.mark.env_onecard def test_spacetodepth_graph_float32(): SpaceToDepth(np.float32) @pytest.mark.level0 -@pytest.mark.platform_x86_gpu_training +@pytest.mark.platform_x86_cpu @pytest.mark.env_onecard def test_spacetodepth_graph_float16(): SpaceToDepth(np.float16) @pytest.mark.level0 -@pytest.mark.platform_x86_gpu_training +@pytest.mark.platform_x86_cpu @pytest.mark.env_onecard def test_spacetodepth_graph_int32(): SpaceToDepth(np.int32) @pytest.mark.level0 -@pytest.mark.platform_x86_gpu_training +@pytest.mark.platform_x86_cpu @pytest.mark.env_onecard def test_spacetodepth_graph_int64(): SpaceToDepth(np.int64) @pytest.mark.level0 -@pytest.mark.platform_x86_gpu_training +@pytest.mark.platform_x86_cpu @pytest.mark.env_onecard def test_spacetodepth_graph_int8(): SpaceToDepth(np.int8) @pytest.mark.level0 -@pytest.mark.platform_x86_gpu_training +@pytest.mark.platform_x86_cpu @pytest.mark.env_onecard def test_spacetodepth_graph_int16(): SpaceToDepth(np.int16) @pytest.mark.level0 -@pytest.mark.platform_x86_gpu_training +@pytest.mark.platform_x86_cpu @pytest.mark.env_onecard def test_spacetodepth_graph_uint8(): SpaceToDepth(np.uint8) @pytest.mark.level0 -@pytest.mark.platform_x86_gpu_training +@pytest.mark.platform_x86_cpu @pytest.mark.env_onecard def test_spacetodepth_graph_uint16(): SpaceToDepth(np.uint16) @pytest.mark.level0 -@pytest.mark.platform_x86_gpu_training +@pytest.mark.platform_x86_cpu @pytest.mark.env_onecard def test_spacetodepth_graph_uint32(): SpaceToDepth(np.uint32) @pytest.mark.level0 -@pytest.mark.platform_x86_gpu_training +@pytest.mark.platform_x86_cpu @pytest.mark.env_onecard def test_spacetodepth_graph_uint64(): SpaceToDepth(np.uint64) diff --git a/tests/st/ops/cpu/test_squared_difference_op.py b/tests/st/ops/cpu/test_squared_difference_op.py index 1f54df56fe6..b3ce1e6ee7c 100644 --- a/tests/st/ops/cpu/test_squared_difference_op.py +++ b/tests/st/ops/cpu/test_squared_difference_op.py @@ -35,7 +35,7 @@ class Net(nn.Cell): @pytest.mark.level0 -@pytest.mark.platform_x86_cpu_training +@pytest.mark.platform_x86_cpu @pytest.mark.env_onecard def test_net01(): net = Net() @@ -65,7 +65,7 @@ def test_net01(): @pytest.mark.level0 -@pytest.mark.platform_x86_cpu_training +@pytest.mark.platform_x86_cpu @pytest.mark.env_onecard def test_net02(): net = Net() diff --git a/tests/st/ops/cpu/test_unpack_op.py b/tests/st/ops/cpu/test_unpack_op.py index c2898c94504..bce2f70534c 100644 --- a/tests/st/ops/cpu/test_unpack_op.py +++ b/tests/st/ops/cpu/test_unpack_op.py @@ -132,84 +132,84 @@ def unpack_pynative(nptype): @pytest.mark.level0 -@pytest.mark.platform_x86_cpu_training +@pytest.mark.platform_x86_cpu @pytest.mark.env_onecard def test_unpack_graph_float32(): unpack(np.float32) @pytest.mark.level0 -@pytest.mark.platform_x86_cpu_training +@pytest.mark.platform_x86_cpu @pytest.mark.env_onecard def test_unpack_graph_float16(): unpack(np.float16) @pytest.mark.level0 -@pytest.mark.platform_x86_cpu_training +@pytest.mark.platform_x86_cpu @pytest.mark.env_onecard def test_unpack_graph_int32(): unpack(np.int32) @pytest.mark.level0 -@pytest.mark.platform_x86_cpu_training +@pytest.mark.platform_x86_cpu @pytest.mark.env_onecard def test_unpack_graph_int16(): unpack(np.int16) @pytest.mark.level0 -@pytest.mark.platform_x86_cpu_training +@pytest.mark.platform_x86_cpu @pytest.mark.env_onecard def test_unpack_graph_uint8(): unpack(np.uint8) @pytest.mark.level0 -@pytest.mark.platform_x86_cpu_training +@pytest.mark.platform_x86_cpu @pytest.mark.env_onecard def test_unpack_graph_bool(): unpack(np.bool) @pytest.mark.level0 -@pytest.mark.platform_x86_cpu_training +@pytest.mark.platform_x86_cpu @pytest.mark.env_onecard def test_unpack_pynative_float32(): unpack_pynative(np.float32) @pytest.mark.level0 -@pytest.mark.platform_x86_cpu_training +@pytest.mark.platform_x86_cpu @pytest.mark.env_onecard def test_unpack_pynative_float16(): unpack_pynative(np.float16) @pytest.mark.level0 -@pytest.mark.platform_x86_cpu_training +@pytest.mark.platform_x86_cpu @pytest.mark.env_onecard def test_unpack_pynative_int32(): unpack_pynative(np.int32) @pytest.mark.level0 -@pytest.mark.platform_x86_cpu_training +@pytest.mark.platform_x86_cpu @pytest.mark.env_onecard def test_unpack_pynative_int16(): unpack_pynative(np.int16) @pytest.mark.level0 -@pytest.mark.platform_x86_cpu_training +@pytest.mark.platform_x86_cpu @pytest.mark.env_onecard def test_unpack_pynative_uint8(): unpack_pynative(np.uint8) @pytest.mark.level0 -@pytest.mark.platform_x86_cpu_training +@pytest.mark.platform_x86_cpu @pytest.mark.env_onecard def test_unpack_pynative_bool(): unpack_pynative(np.bool) diff --git a/tests/st/ops/cpu/test_zeroslike_op.py b/tests/st/ops/cpu/test_zeroslike_op.py index 45411558bb7..4f37cc37180 100644 --- a/tests/st/ops/cpu/test_zeroslike_op.py +++ b/tests/st/ops/cpu/test_zeroslike_op.py @@ -32,7 +32,7 @@ class NetZerosLike(nn.Cell): @pytest.mark.level0 -@pytest.mark.platform_x86_cpu_training +@pytest.mark.platform_x86_cpu @pytest.mark.env_onecard def test_ZerosLike(): x0_np = np.random.uniform(-2, 2, (2, 3, 4, 4)).astype(np.float32)