提交 f0ab20fe 编写于 作者: M mindspore-ci-bot 提交者: Gitee

!2409 add st testcases pytest mark

Merge pull request !2409 from amongo/AddTensorSetItemSTCases
......@@ -44,6 +44,10 @@ class NetWorkSlicePositive(Cell):
return ret0, ret1, ret2, ret3
@pytest.mark.level0
@pytest.mark.platform_arm_ascend_training
@pytest.mark.platform_x86_ascend_training
@pytest.mark.env_onecard
def test_slice_positive():
net = NetWorkSlicePositive()
input_np = np.arange(6*8*10).reshape(6, 8, 10).astype(np.int32)
......@@ -143,7 +147,12 @@ class TensorGetItemByThreeTensors(Cell):
return ret0, ret1, ret2
def test_getitem_by_tensors():
@pytest.mark.level0
@pytest.mark.platform_arm_ascend_training
@pytest.mark.platform_x86_ascend_training
@pytest.mark.env_onecard
def Xtest_getitem_by_tensors():
"""This testcase may encounter a sync stream error occassionally"""
net = TensorGetItemByThreeTensors()
input_x = np.arange(6*8*10).reshape(6, 8, 10).astype(np.int32)
index_0 = np.random.randint(6, size=(3, 4, 5)).astype(np.int32)
......@@ -179,6 +188,10 @@ class TensorGetItemByMixedTensorsBasicCase(Cell):
return ret0, ret1, ret2, ret3, ret4, ret5
@pytest.mark.level0
@pytest.mark.platform_arm_ascend_training
@pytest.mark.platform_x86_ascend_training
@pytest.mark.env_onecard
def test_getitem_by_mixed_tensors():
const0 = np.ones((3, 4, 5, 3), np.float32)
const1 = np.ones((3, 3, 4, 5, 5), np.float32)
......@@ -217,6 +230,10 @@ class TensorSetItemByMixedTensors_0(Cell):
return ret
@pytest.mark.level0
@pytest.mark.platform_arm_ascend_training
@pytest.mark.platform_x86_ascend_training
@pytest.mark.env_onecard
def test_setitem_by_mixed_tensors_0():
value = 88.0
net = TensorSetItemByMixedTensors_0(value)
......@@ -247,6 +264,10 @@ class TensorSetItemByMixedTensors_1(Cell):
return ret
@pytest.mark.level0
@pytest.mark.platform_arm_ascend_training
@pytest.mark.platform_x86_ascend_training
@pytest.mark.env_onecard
def test_setitem_by_mixed_tensors_1():
value = 88.0
net = TensorSetItemByMixedTensors_1(value)
......@@ -277,6 +298,10 @@ class TensorSetItemByMixedTensors_2(Cell):
return ret
@pytest.mark.level0
@pytest.mark.platform_arm_ascend_training
@pytest.mark.platform_x86_ascend_training
@pytest.mark.env_onecard
def test_setitem_by_mixed_tensors_2():
value = 88.0
net = TensorSetItemByMixedTensors_2(value)
......@@ -324,6 +349,10 @@ class TensorSetItemByOneTensorWithNumber(Cell):
return ret
@pytest.mark.level0
@pytest.mark.platform_arm_ascend_training
@pytest.mark.platform_x86_ascend_training
@pytest.mark.env_onecard
def test_setitem_one_tensor_with_number():
value = 0.0
net = TensorSetItemByOneTensorWithNumber(value)
......@@ -348,6 +377,10 @@ class TensorSetItemByOneTensorWithTensor(Cell):
return ret
@pytest.mark.level0
@pytest.mark.platform_arm_ascend_training
@pytest.mark.platform_x86_ascend_training
@pytest.mark.env_onecard
def test_setitem_by_one_tensor_with_tensor():
net = TensorSetItemByOneTensorWithTensor()
index_np = np.random.randint(4, size=(5, 4))
......@@ -374,6 +407,10 @@ class TensorSetItemByOneTensorWithTupleOfNumber(Cell):
return ret
@pytest.mark.level0
@pytest.mark.platform_arm_ascend_training
@pytest.mark.platform_x86_ascend_training
@pytest.mark.env_onecard
def test_setitem_by_one_tensor_with_tuple_number():
value = (0.0, 1.1, 2.2, 3.3, 4.4, 5.5, 6.6, 7.7)
net = TensorSetItemByOneTensorWithTupleOfNumber(value)
......@@ -398,6 +435,10 @@ class TensorSetItemByOneTensorWithTupleOfTensor(Cell):
return ret
@pytest.mark.level0
@pytest.mark.platform_arm_ascend_training
@pytest.mark.platform_x86_ascend_training
@pytest.mark.env_onecard
def test_setitem_by_one_tensor_with_tuple_tensors():
net = TensorSetItemByOneTensorWithTupleOfTensor()
input_np = np.random.randint(6, size=(5, 4)).astype(np.int32)
......@@ -428,6 +469,10 @@ class TensorSetItemByTensorsWithNumber(Cell):
return ret
@pytest.mark.level0
@pytest.mark.platform_arm_ascend_training
@pytest.mark.platform_x86_ascend_training
@pytest.mark.env_onecard
def test_setitem_by_tensors_with_number():
value = 0.0
net = TensorSetItemByTensorsWithNumber(value)
......@@ -456,6 +501,10 @@ class TensorSetItemByTensorsWithTensor(Cell):
return ret
@pytest.mark.level0
@pytest.mark.platform_arm_ascend_training
@pytest.mark.platform_x86_ascend_training
@pytest.mark.env_onecard
def test_setitem_by_tensors_with_tensor():
net = TensorSetItemByTensorsWithTensor()
index_0 = np.random.randint(6, size=(3, 4, 5))
......@@ -485,6 +534,10 @@ class TensorSetItemByTensorsWithTensorNumberError(Cell):
return ret
@pytest.mark.level0
@pytest.mark.platform_arm_ascend_training
@pytest.mark.platform_x86_ascend_training
@pytest.mark.env_onecard
def test_setitem_by_tensors_with_tensor_error():
index_0 = Tensor(np.random.randint(6, size=(3, 4, 5)), mstype.int32)
index_1 = Tensor(np.random.randint(7, size=(4, 5)), mstype.int32)
......@@ -509,6 +562,10 @@ class TensorSetItemByTensorsWithTupleOfNumber(Cell):
return ret
@pytest.mark.level0
@pytest.mark.platform_arm_ascend_training
@pytest.mark.platform_x86_ascend_training
@pytest.mark.env_onecard
def test_setitem_by_tensors_with_tuple_of_number():
value = (0.0, 1.1, 2.2, 3.3, 4.4)
net = TensorSetItemByTensorsWithTupleOfNumber(value)
......@@ -537,6 +594,10 @@ class TensorSetItemByTensorsWithTupleOfTensor(Cell):
return ret
@pytest.mark.level0
@pytest.mark.platform_arm_ascend_training
@pytest.mark.platform_x86_ascend_training
@pytest.mark.env_onecard
def test_setitem_by_tensors_with_tuple_of_tensor():
value_0 = np.zeros((4, 5))
value_1 = np.ones((4, 5))
......@@ -570,6 +631,10 @@ class TensorSetItemByTensorsWithTupleOfTensorNumberError(Cell):
return ret
@pytest.mark.level0
@pytest.mark.platform_arm_ascend_training
@pytest.mark.platform_x86_ascend_training
@pytest.mark.env_onecard
def test_setitem_by_tensor_with_tuple_of_tensor_error():
net = TensorSetItemByTensorsWithTupleOfTensorNumberError()
index_0_ms = Tensor(np.random.randint(6, size=(3, 4, 5)), mstype.int32)
......@@ -661,6 +726,10 @@ class TensorAssignWithSlice(Cell):
return z
@pytest.mark.level0
@pytest.mark.platform_arm_ascend_training
@pytest.mark.platform_x86_ascend_training
@pytest.mark.env_onecard
def test_tensor_assign_slice_value_1():
net = TensorAssignWithSlice()
a = np.arange(60).reshape(3, 4, 5)
......@@ -682,6 +751,10 @@ def test_tensor_assign_slice_value_1():
assert np.all(z == out.asnumpy())
@pytest.mark.level0
@pytest.mark.platform_arm_ascend_training
@pytest.mark.platform_x86_ascend_training
@pytest.mark.env_onecard
def test_tensor_assign_slice_value_2():
net2 = TensorAssignWithSlice2()
a = np.array([1, 2, 3, 4, 5, 6, 7, 8])
......@@ -701,6 +774,10 @@ def test_tensor_assign_slice_value_2():
assert np.all(z == out.asnumpy())
@pytest.mark.level0
@pytest.mark.platform_arm_ascend_training
@pytest.mark.platform_x86_ascend_training
@pytest.mark.env_onecard
def test_tensor_assign_exception():
net = TensorAssignWithSlice()
net2 = TensorAssignWithSlice2()
......@@ -886,6 +963,10 @@ class TensorAssignWithBoolTensorIndex2Error(Cell):
return a
@pytest.mark.level0
@pytest.mark.platform_arm_ascend_training
@pytest.mark.platform_x86_ascend_training
@pytest.mark.env_onecard
def test_tensor_assign_bool_index_0():
a = np.arange(60).reshape(3, 4, 5)
b = a > 5
......@@ -903,6 +984,10 @@ def test_tensor_assign_bool_index_0():
assert np.all(out.asnumpy() == res)
@pytest.mark.level0
@pytest.mark.platform_arm_ascend_training
@pytest.mark.platform_x86_ascend_training
@pytest.mark.env_onecard
def test_tensor_assign_bool_index_1():
a = np.arange(60).reshape(3, 4, 5)
Ta = Tensor(a, dtype=mstype.float32)
......@@ -992,6 +1077,10 @@ def Xtest_tensor_slice_reduce_out_of_bounds_positive():
assert "For 'StridedSlice' the `begin[0]` should be an int and must less than 6, but got `6`" in str(ex.value)
@pytest.mark.level0
@pytest.mark.platform_arm_ascend_training
@pytest.mark.platform_x86_ascend_training
@pytest.mark.env_onecard
def test_tensor_range():
a = np.arange(4*5*6).reshape(4, 5, 6).astype(np.float32)
ta = Tensor(a, mstype.float32)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册