Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
magicwindyyd
mindspore
提交
03459950
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看板
提交
03459950
编写于
5月 13, 2020
作者:
M
mindspore-ci-bot
提交者:
Gitee
5月 13, 2020
浏览文件
操作
浏览文件
下载
差异文件
!1110 [AutoParallel]fix gatherv2 and dataset bug
Merge pull request !1110 from lichen/fix_gatherv2_and_dataset_bug
上级
a2d5ad5a
debfd38b
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
22 addition
and
18 deletion
+22
-18
mindspore/ccsrc/parallel/step_parallel.cc
mindspore/ccsrc/parallel/step_parallel.cc
+16
-11
mindspore/train/dataset_helper.py
mindspore/train/dataset_helper.py
+6
-6
tests/ut/python/parallel/test_gather_v2.py
tests/ut/python/parallel/test_gather_v2.py
+0
-1
未找到文件。
mindspore/ccsrc/parallel/step_parallel.cc
浏览文件 @
03459950
...
...
@@ -618,19 +618,11 @@ void StepReplaceGraph(const ReplaceGraphPtr &replace_graph, const CNodePtr &node
for
(
auto
&
replace_input
:
replace_graph
->
first
)
{
auto
pre_node
=
node
->
input
(
IntToSize
(
replace_input
.
second
));
manager
->
SetEdge
(
replace_input
.
first
,
1
,
pre_node
);
auto
replace_input_cnode
=
replace_input
.
first
->
cast
<
CNodePtr
>
();
MS_EXCEPTION_IF_NULL
(
replace_input_cnode
);
(
void
)
replace_input_cnode
->
set_operator_info
(
node
->
operator_info
());
replace_input_cnode
->
set_in_forward_flag
(
true
);
// mark this new cnode is forward node
}
// "(void)manager->Replace(replace_graph->first, pre_node);" can not be called
auto
replace_output
=
replace_graph
->
second
;
MS_EXCEPTION_IF_NULL
(
replace_output
);
(
void
)
manager
->
Replace
(
node
,
replace_output
);
CNodePtr
replace_output_cnode
=
replace_graph
->
second
->
cast
<
CNodePtr
>
();
MS_EXCEPTION_IF_NULL
(
replace_output_cnode
);
(
void
)
replace_output_cnode
->
set_operator_info
(
node
->
operator_info
());
replace_output_cnode
->
set_in_forward_flag
(
true
);
// mark this new cnode is forward node
}
int32_t
GetTupleGetItemIndex
(
const
CNodePtr
&
cnode
)
{
...
...
@@ -1994,14 +1986,27 @@ void ParallelCommunication(const FuncGraphPtr &root, const std::vector<AnfNodePt
BackwardCommunication
(
distribute_operator
,
cnode
,
sens_loss_pairs
);
}
// StepReplace
StepReplace
(
distribute_operator
,
cnode
);
HandleSpecialNode
(
distribute_operator
,
cnode
);
}
else
if
(
IsValueNode
<
Tensor
>
(
node
))
{
StepSplitTensor
(
node
,
manager
);
}
}
for
(
auto
&
node
:
all_nodes
)
{
MS_EXCEPTION_IF_NULL
(
node
);
if
(
node
->
isa
<
CNode
>
())
{
auto
cnode
=
node
->
cast
<
CNodePtr
>
();
if
(
!
IsValueNode
<
Primitive
>
(
cnode
->
input
(
0
)))
{
continue
;
}
OperatorInfoPtr
distribute_operator
=
GetDistributeOperator
(
cnode
);
if
(
distribute_operator
==
nullptr
)
{
continue
;
}
// StepReplace
StepReplace
(
distribute_operator
,
cnode
);
}
}
}
namespace
{
...
...
mindspore/train/dataset_helper.py
浏览文件 @
03459950
...
...
@@ -83,12 +83,6 @@ class _DatasetIter:
self
.
dataset
=
dataset
dataset_types
,
dataset_shapes
=
_get_types_and_shapes
(
dataset
)
self
.
dataset_types
,
self
.
dataset_shapes
=
dataset_types
,
dataset_shapes
# for self._parallel_mode equal to semi_auto_parallel or auto_parallel, use a complete tensor to
# compile, and slice tensor to run. The batch dimension of tensors for compile is device_number
# times the batch dimension of tensors for run
if
_get_parallel_mode
()
in
(
ParallelMode
.
SEMI_AUTO_PARALLEL
,
ParallelMode
.
AUTO_PARALLEL
):
device_num
=
_get_device_num
()
self
.
dataset_shapes
=
_to_full_shapes
(
dataset_shapes
,
device_num
)
def
__iter__
(
self
):
self
.
ind
=
0
...
...
@@ -119,6 +113,12 @@ class _DatasetIterMSLoopSink(_DatasetIter):
def
__init__
(
self
,
dataset
):
super
(
_DatasetIterMSLoopSink
,
self
).
__init__
(
dataset
)
self
.
loop_count
=
self
.
get_loop_count
(
dataset
)
# for self._parallel_mode equal to semi_auto_parallel or auto_parallel, use a complete tensor to
# compile, and slice tensor to run. The batch dimension of tensors for compile is device_number
# times the batch dimension of tensors for run. Now only support LoopSink.
if
_get_parallel_mode
()
in
(
ParallelMode
.
SEMI_AUTO_PARALLEL
,
ParallelMode
.
AUTO_PARALLEL
):
device_num
=
_get_device_num
()
self
.
dataset_shapes
=
_to_full_shapes
(
self
.
dataset_shapes
,
device_num
)
def
op
():
return
tuple
()
...
...
tests/ut/python/parallel/test_gather_v2.py
浏览文件 @
03459950
...
...
@@ -170,4 +170,3 @@ def test_gatherv2_auto1():
x
=
Tensor
(
np
.
ones
([
64
,
32
]),
dtype
=
ms
.
float32
)
y
=
Tensor
(
np
.
ones
([
64
,
64
,
64
]),
dtype
=
ms
.
float32
)
_executor
.
compile
(
net
,
x
,
y
)
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录