Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
magicwindyyd
mindspore
提交
96b38f72
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看板
提交
96b38f72
编写于
6月 28, 2020
作者:
H
huangdongrun
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add ExpandDims whitelist
add comment for control_depend
上级
f6575616
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
30 addition
and
0 deletion
+30
-0
mindspore/ccsrc/optimizer/irpass/branch_culling.cc
mindspore/ccsrc/optimizer/irpass/branch_culling.cc
+1
-0
mindspore/ops/operations/control_ops.py
mindspore/ops/operations/control_ops.py
+2
-0
tests/ut/python/pipeline/parse/test_fix_bug.py
tests/ut/python/pipeline/parse/test_fix_bug.py
+27
-0
未找到文件。
mindspore/ccsrc/optimizer/irpass/branch_culling.cc
浏览文件 @
96b38f72
...
@@ -74,6 +74,7 @@ bool InConvertWhiteList(const AnfNodePtr &node, size_t index) {
...
@@ -74,6 +74,7 @@ bool InConvertWhiteList(const AnfNodePtr &node, size_t index) {
{
prim
::
kPrimApplyRMSProp
,
{
6
,
7
,
8
}},
{
prim
::
kPrimApplyRMSProp
,
{
6
,
7
,
8
}},
{
prim
::
kPrimCumSum
,
{
2
}},
{
prim
::
kPrimCumSum
,
{
2
}},
{
prim
::
kPrimTile
,
{
2
}},
{
prim
::
kPrimTile
,
{
2
}},
{
prim
::
kPrimExpandDims
,
{
2
}},
{
prim
::
kPrimHistogramSummary
,
{
1
}}});
{
prim
::
kPrimHistogramSummary
,
{
1
}}});
for
(
auto
&
item
:
white_list
)
{
for
(
auto
&
item
:
white_list
)
{
auto
matched
=
std
::
any_of
(
item
.
second
.
begin
(),
item
.
second
.
end
(),
[
&
item
,
&
node
,
&
index
](
size_t
idx
)
{
auto
matched
=
std
::
any_of
(
item
.
second
.
begin
(),
item
.
second
.
end
(),
[
&
item
,
&
node
,
&
index
](
size_t
idx
)
{
...
...
mindspore/ops/operations/control_ops.py
浏览文件 @
96b38f72
...
@@ -30,6 +30,8 @@ class ControlDepend(Primitive):
...
@@ -30,6 +30,8 @@ class ControlDepend(Primitive):
tells the engine that the destination operations should depend on the source operation which means the source
tells the engine that the destination operations should depend on the source operation which means the source
operations should be executed before the destination.
operations should be executed before the destination.
Note:
This operation does not work in `PYNATIVE_MODE`.
Args:
Args:
depend_mode (int): Use 0 for normal depend, 1 for depend on operations that used the parameter. Default: 0.
depend_mode (int): Use 0 for normal depend, 1 for depend on operations that used the parameter. Default: 0.
...
...
tests/ut/python/pipeline/parse/test_fix_bug.py
浏览文件 @
96b38f72
...
@@ -19,6 +19,8 @@ import pytest
...
@@ -19,6 +19,8 @@ import pytest
import
mindspore.nn
as
nn
import
mindspore.nn
as
nn
from
mindspore
import
Tensor
from
mindspore
import
Tensor
from
mindspore.ops
import
composite
as
C
from
mindspore.ops
import
composite
as
C
from
mindspore.ops
import
operations
as
P
from
mindspore.common
import
dtype
as
ms
from
mindspore.common.api
import
_executor
from
mindspore.common.api
import
_executor
...
@@ -116,3 +118,28 @@ def test_parser_map_0002():
...
@@ -116,3 +118,28 @@ def test_parser_map_0002():
net
=
NetMap0002
()
net
=
NetMap0002
()
with
pytest
.
raises
(
TypeError
):
with
pytest
.
raises
(
TypeError
):
net
(
input_me_x
)
net
(
input_me_x
)
def
test_fix_expanddims_loss_scale
():
class
ControlOneIfOneScaleOneScale
(
nn
.
Cell
):
def
__init__
(
self
):
super
().
__init__
()
self
.
op
=
P
.
ExpandDims
()
def
construct
(
self
,
x
,
y
,
data
):
if
x
>
y
:
out
=
1
else
:
out
=
2
if
x
>
y
:
out
=
self
.
op
(
data
,
out
)
else
:
out
=
self
.
op
(
data
,
out
)
return
out
net
=
ControlOneIfOneScaleOneScale
()
x
=
Tensor
(
1
,
ms
.
float32
)
y
=
Tensor
(
0
,
ms
.
float32
)
input_shape
=
(
1024
,
512
,
7
,
7
)
input_data
=
np
.
random
.
randn
(
*
input_shape
).
astype
(
np
.
float32
)
net
=
ControlOneIfOneScaleOneScale
()
net
(
x
,
y
,
Tensor
(
input_data
))
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录