Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
magicwindyyd
mindspore
提交
2c9ca199
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看板
提交
2c9ca199
编写于
6月 19, 2020
作者:
B
buxue
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
support catch IndexError in C++
上级
65f2212f
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
27 addition
and
6 deletion
+27
-6
mindspore/ccsrc/pipeline/pipeline.cc
mindspore/ccsrc/pipeline/pipeline.cc
+3
-0
tests/ut/python/ops/test_tuple_slice.py
tests/ut/python/ops/test_tuple_slice.py
+24
-6
未找到文件。
mindspore/ccsrc/pipeline/pipeline.cc
浏览文件 @
2c9ca199
...
...
@@ -471,6 +471,9 @@ bool ExecutorPy::Compile(const py::object &obj, const py::tuple &args, const py:
}
catch
(
const
py
::
value_error
&
ex
)
{
ReleaseResource
(
phase
);
throw
py
::
value_error
(
ex
);
}
catch
(
const
py
::
index_error
&
ex
)
{
ReleaseResource
(
phase
);
throw
py
::
index_error
(
ex
);
}
catch
(
const
std
::
exception
&
ex
)
{
ReleaseResource
(
phase
);
// re-throw this exception to Python interpreter to handle it
...
...
tests/ut/python/ops/test_tuple_slice.py
浏览文件 @
2c9ca199
...
...
@@ -80,6 +80,17 @@ class NetWork_3(Cell):
return
res
class
NetWorkOutOfBounds
(
Cell
):
""" NetWork_3 definition """
def
__init__
(
self
):
super
(
NetWorkOutOfBounds
,
self
).
__init__
()
self
.
addN
=
P
.
AddN
()
def
construct
(
self
,
tensor_tuple
):
return
tensor_tuple
[
100
]
test_cases
=
[
(
'SlicePositive'
,
{
'block'
:
NetWork_1
(),
...
...
@@ -104,16 +115,23 @@ test_cases = [
test_cases_for_verify_exception
=
[
(
'SliceStartCross'
,
{
'block'
:
(
NetWork_3
(),
{
'exception'
:
RuntimeError
}),
'desc_inputs'
:
[
*
(
Tensor
(
np
.
ones
([
2
,
3
,
4
],
np
.
int32
)),
Tensor
(
np
.
zeros
([
2
,
3
,
4
],
np
.
int32
)),
Tensor
(
np
.
ones
([
2
,
3
,
4
],
np
.
int32
)
))],
'desc_inputs'
:
[
Tensor
(
np
.
ones
([
2
,
3
,
4
],
np
.
int32
)),
Tensor
(
np
.
zeros
([
2
,
3
,
4
],
np
.
int32
)),
Tensor
(
np
.
ones
([
2
,
3
,
4
],
np
.
int32
))],
}),
(
'SliceStepZero'
,
{
'block'
:
(
NetWork_3
(),
{
'exception'
:
RuntimeError
}),
'desc_inputs'
:
[
*
(
Tensor
(
np
.
ones
([
2
,
3
,
4
],
np
.
int32
)),
Tensor
(
np
.
zeros
([
2
,
3
,
4
],
np
.
int32
)),
Tensor
(
np
.
ones
([
2
,
3
,
4
],
np
.
int32
)))],
'desc_inputs'
:
[
Tensor
(
np
.
ones
([
2
,
3
,
4
],
np
.
int32
)),
Tensor
(
np
.
zeros
([
2
,
3
,
4
],
np
.
int32
)),
Tensor
(
np
.
ones
([
2
,
3
,
4
],
np
.
int32
))],
}),
(
'SliceOutOfBounds'
,
{
'block'
:
(
NetWorkOutOfBounds
(),
{
'exception'
:
IndexError
}),
'desc_inputs'
:
[(
Tensor
(
np
.
ones
([
2
,
3
,
4
],
np
.
int32
)),
Tensor
(
np
.
zeros
([
2
,
3
,
4
],
np
.
int32
)),
Tensor
(
np
.
ones
([
2
,
3
,
4
],
np
.
int32
)))],
}),
]
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录