Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
magicwindyyd
mindspore
提交
e9e4442d
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看板
提交
e9e4442d
编写于
6月 22, 2020
作者:
M
mindspore-ci-bot
提交者:
Gitee
6月 22, 2020
浏览文件
操作
浏览文件
下载
差异文件
!2413 [Auto parallel] Check 'CAST' from optimizers
Merge pull request !2413 from Xiaoda/7-auto-parallel-check-optimizer-ops
上级
83b53559
3ff6e336
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
15 addition
and
10 deletion
+15
-10
mindspore/ccsrc/parallel/ops_info/ops_utils.h
mindspore/ccsrc/parallel/ops_info/ops_utils.h
+1
-0
mindspore/ccsrc/parallel/step_auto_parallel.cc
mindspore/ccsrc/parallel/step_auto_parallel.cc
+4
-0
tests/ut/python/parallel/test_auto_parallel_cast.py
tests/ut/python/parallel/test_auto_parallel_cast.py
+4
-4
tests/ut/python/parallel/test_auto_parallel_parameter_cast.py
...s/ut/python/parallel/test_auto_parallel_parameter_cast.py
+6
-6
未找到文件。
mindspore/ccsrc/parallel/ops_info/ops_utils.h
浏览文件 @
e9e4442d
...
...
@@ -130,6 +130,7 @@ constexpr char FORWARD_OP[] = "forward_op";
constexpr
char
REDISTRIBUTION_OP
[]
=
"redistribution_op"
;
constexpr
char
DARA_PARALLEL
[]
=
"data_parallel"
;
constexpr
char
FORWARD_REDUCE_SCATTER
[]
=
"forward_reduce_scatter"
;
constexpr
char
OPTIMIZER_SUB_STRING
[]
=
"optimizer"
;
// Operator
constexpr
char
VIRTUAL_DIV
[]
=
"_VirtualDiv"
;
...
...
mindspore/ccsrc/parallel/step_auto_parallel.cc
浏览文件 @
e9e4442d
...
...
@@ -283,6 +283,10 @@ bool IsAutoParallelCareNode(const CNodePtr &cnode) {
if
(
bool_result
)
{
MS_LOG
(
EXCEPTION
)
<<
"Should implementing OperatorInfo for: "
<<
prim
->
name
();
}
else
if
(
prim
->
name
()
==
CAST
)
{
if
(
cnode
->
fullname_with_scope
().
find
(
OPTIMIZER_SUB_STRING
)
!=
std
::
string
::
npos
)
{
// Do not care CASTs from optimizer
return
false
;
}
return
true
;
}
return
IsParallelCareNode
(
cnode
)
&&
IsSplittableOperator
(
prim
->
name
());
...
...
tests/ut/python/parallel/test_auto_parallel_cast.py
浏览文件 @
e9e4442d
...
...
@@ -80,9 +80,9 @@ def test_double_star_graph():
_executor
.
compile
(
net
,
x
,
y
,
z
,
w
,
phase
=
'train'
)
strategies
=
_executor
.
_get_strategy
(
net
)
expected_strategies
=
{
'Default/network-Net/Cast-op
1
'
:
[[
8
,
1
]],
'Default/network-Net/Cast-op
3
'
:
[[
1
,
8
]],
'Default/network-Net/MatMul-op
2
'
:
[[
8
,
1
],
[
1
,
1
]],
expected_strategies
=
{
'Default/network-Net/Cast-op
0
'
:
[[
8
,
1
]],
'Default/network-Net/Cast-op
1
'
:
[[
1
,
8
]],
'Default/network-Net/MatMul-op
3
'
:
[[
8
,
1
],
[
1
,
1
]],
'Default/network-Net/MatMul-op4'
:
[[
1
,
1
],
[
1
,
8
]],
'Default/network-Net/MatMul-op
0
'
:
[[
1
,
8
],
[
8
,
1
]]}
'Default/network-Net/MatMul-op
2
'
:
[[
1
,
8
],
[
8
,
1
]]}
assert
strategies
==
expected_strategies
tests/ut/python/parallel/test_auto_parallel_parameter_cast.py
浏览文件 @
e9e4442d
...
...
@@ -12,6 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import
re
import
numpy
as
np
import
mindspore
as
ms
...
...
@@ -69,9 +70,8 @@ def test_common_parameter():
_executor
.
compile
(
net
,
x
,
y
,
phase
=
'train'
)
strategies
=
_executor
.
_get_strategy
(
net
)
expected_strategies
=
{
'Default/network-Net/MatMul-op1'
:
[[
8
,
1
],
[
1
,
1
]],
'Default/network-Net/MatMul-op3'
:
[[
8
,
1
],
[
1
,
1
]],
'Default/network-Net/Cast-op2'
:
[[
1
,
1
]],
'Default/network-Net/MatMul-op0'
:
[[
8
,
1
],
[
1
,
1
]],
'Default/network-Net/Cast-op4'
:
[[
1
,
1
]]}
assert
strategies
==
expected_strategies
for
(
k
,
v
)
in
strategies
.
items
():
if
re
.
search
(
'MatMul-op'
,
k
)
is
not
None
:
assert
v
==
[[
8
,
1
],
[
1
,
1
]]
elif
re
.
search
(
'Cast-op'
,
k
)
is
not
None
:
assert
v
==
[[
1
,
1
]]
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录