Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
magicwindyyd
mindspore
提交
f0ab20fe
M
mindspore
项目概览
magicwindyyd
/
mindspore
与 Fork 源项目一致
Fork自
MindSpore / mindspore
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
mindspore
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
f0ab20fe
编写于
6月 29, 2020
作者:
M
mindspore-ci-bot
提交者:
Gitee
6月 29, 2020
浏览文件
操作
浏览文件
下载
差异文件
!2409 add st testcases pytest mark
Merge pull request !2409 from amongo/AddTensorSetItemSTCases
上级
7222dddb
71f8ecbc
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
90 addition
and
1 deletion
+90
-1
tests/st/pynative/test_tensor_index.py
tests/st/pynative/test_tensor_index.py
+90
-1
未找到文件。
tests/st/pynative/test_tensor_index.py
浏览文件 @
f0ab20fe
...
...
@@ -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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录