Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
magicwindyyd
mindspore
提交
7dc31684
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看板
提交
7dc31684
编写于
5月 12, 2020
作者:
M
mindspore-ci-bot
提交者:
Gitee
5月 12, 2020
浏览文件
操作
浏览文件
下载
差异文件
!1073 fix reshape tensor redistribution bug
Merge pull request !1073 from yao_yf/reshape_bug_fix
上级
8003a89a
b0921c15
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
27 addition
and
9 deletion
+27
-9
mindspore/ccsrc/parallel/auto_parallel/operator_costmodel.h
mindspore/ccsrc/parallel/auto_parallel/operator_costmodel.h
+2
-2
mindspore/ccsrc/parallel/ops_info/gather_v2_p_info.h
mindspore/ccsrc/parallel/ops_info/gather_v2_p_info.h
+4
-1
mindspore/ccsrc/parallel/ops_info/reshape_info.cc
mindspore/ccsrc/parallel/ops_info/reshape_info.cc
+7
-6
mindspore/ccsrc/parallel/ops_info/reshape_info.h
mindspore/ccsrc/parallel/ops_info/reshape_info.h
+2
-0
mindspore/ccsrc/parallel/tensor_layout/reshape_layout_transfer.cc
...e/ccsrc/parallel/tensor_layout/reshape_layout_transfer.cc
+12
-0
未找到文件。
mindspore/ccsrc/parallel/auto_parallel/operator_costmodel.h
浏览文件 @
7dc31684
...
...
@@ -616,8 +616,8 @@ using GatherV2CostPtr = std::shared_ptr<GatherV2Cost>;
class
GatherV2PCost
:
public
OperatorCost
{
public:
explicit
GatherV2PCost
(
bool
is_inputs_related
)
:
OperatorCost
(
is_inputs_related
)
{}
GatherV2PCost
()
:
OperatorCost
(
true
)
{}
explicit
GatherV2PCost
(
bool
is_inputs_related
)
:
OperatorCost
(
is_inputs_related
)
,
axis_
(
0
)
{}
GatherV2PCost
()
:
OperatorCost
(
true
)
,
axis_
(
0
)
{}
~
GatherV2PCost
()
override
=
default
;
double
GetCommCost
(
const
std
::
vector
<
TensorInfo
>
&
inputs
,
const
std
::
vector
<
TensorInfo
>
&
outputs
,
...
...
mindspore/ccsrc/parallel/ops_info/gather_v2_p_info.h
浏览文件 @
7dc31684
...
...
@@ -33,7 +33,10 @@ class GatherV2PInfo : public OperatorInfo {
public:
GatherV2PInfo
(
const
std
::
string
&
name
,
const
Shapes
&
inputs_shape
,
const
Shapes
&
outputs_shape
,
const
PrimitiveAttrs
&
attrs
)
:
OperatorInfo
(
name
,
inputs_shape
,
outputs_shape
,
attrs
,
std
::
make_shared
<
GatherV2PCost
>
())
{}
:
OperatorInfo
(
name
,
inputs_shape
,
outputs_shape
,
attrs
,
std
::
make_shared
<
GatherV2PCost
>
()),
axis_
(
0
),
bias_
(
0
),
slice_size_
(
0
)
{}
~
GatherV2PInfo
()
override
=
default
;
Status
Init
(
const
StrategyPtr
&
strategy
)
override
;
Status
InitForCostModel
(
const
StrategyPtr
&
strategy
)
override
;
...
...
mindspore/ccsrc/parallel/ops_info/reshape_info.cc
浏览文件 @
7dc31684
...
...
@@ -456,8 +456,7 @@ Status ReshapeInfo::GenetateStrategyCosts(const std::vector<std::shared_ptr<Stra
return
FAILED
;
}
TensorInfo
pre_out_tensor_info
=
pre_out_tensor_infos
[
out_index
];
TensorLayout
pre_out_tensor_layout
=
pre_out_tensor_info
.
tensor_layout
();
SetInputLayout
(
pre_out_tensor_layout
);
SetInputLayout
(
pre_out_tensor_info
.
tensor_layout
());
// infer pre_node output strategy from output_layout.
Dimensions
stra
=
pre_out_tensor_info
.
InferStrategy
();
if
(
stra
.
empty
())
{
...
...
@@ -481,15 +480,17 @@ Status ReshapeInfo::GenetateStrategyCosts(const std::vector<std::shared_ptr<Stra
return
FAILED
;
}
TensorInfo
next_in_tensor_info
=
next_in_tensor_infos
[
in_index
];
TensorLayout
next_in_tensor_layout
=
next_in_tensor_info
.
tensor_layout
();
SetOutputLayout
(
next_in_tensor_layout
);
SetOutputLayout
(
next_in_tensor_info
.
tensor_layout
());
if
(
Init
(
nullptr
)
==
FAILED
)
{
MS_LOG
(
ERROR
)
<<
"Failure:operator reshape init failed"
;
return
FAILED
;
MS_LOG
(
DEBUG
)
<<
"Failure:operator reshape init failed"
;
continue
;
}
SetCostForReshape
(
reshape_stra
);
}
}
if
(
strategy_cost_
.
empty
())
{
return
FAILED
;
}
return
SUCCESS
;
}
}
// namespace parallel
...
...
mindspore/ccsrc/parallel/ops_info/reshape_info.h
浏览文件 @
7dc31684
...
...
@@ -38,6 +38,8 @@ class ReshapeInfo : public OperatorInfo {
const
PrimitiveAttrs
&
attrs
)
:
OperatorInfo
(
name
,
inputs_shape
,
outputs_shape
,
attrs
,
std
::
make_shared
<
ReshapeCost
>
(
false
)),
dev_num_
(
0
),
pre_operator_index_
(
0
),
next_operator_index_
(
0
),
input_layout_set_flag_
(
false
),
output_layout_set_flag_
(
false
)
{}
~
ReshapeInfo
()
override
=
default
;
...
...
mindspore/ccsrc/parallel/tensor_layout/reshape_layout_transfer.cc
浏览文件 @
7dc31684
...
...
@@ -30,9 +30,18 @@ Status ReshapeLayoutTransfer::CheckValidTransfer() {
std
::
shared_ptr
<
ReshapeLayoutTransfer
>
ReshapeLayoutTransfer
::
UnifyDeviceArrangementAndTensorShape
()
const
{
bool
is_unified
=
IsSameTensorShape
();
std
::
shared_ptr
<
ReshapeLayoutTransfer
>
out_layout_ptr
=
std
::
make_shared
<
ReshapeLayoutTransfer
>
(
*
this
);
if
(
out_layout_ptr
==
nullptr
)
{
return
nullptr
;
}
while
(
!
is_unified
)
{
std
::
shared_ptr
<
ReshapeLayoutTransfer
>
temp_layout_ptr
=
out_layout_ptr
->
ExtendFromTensorShapeByTo
();
if
(
temp_layout_ptr
==
nullptr
)
{
return
nullptr
;
}
out_layout_ptr
=
temp_layout_ptr
->
ExtendToTensorShapeByFrom
();
if
(
out_layout_ptr
==
nullptr
)
{
return
nullptr
;
}
is_unified
=
out_layout_ptr
->
IsSameTensorShape
();
}
return
out_layout_ptr
;
...
...
@@ -91,6 +100,9 @@ std::shared_ptr<ReshapeLayoutTransfer> ReshapeLayoutTransfer::ExtendToTensorShap
}
std
::
shared_ptr
<
ReshapeLayoutTransfer
>
exchanged_out
=
exchanged_from_and_to_ptr
->
ExpandFromTensorShapeAndExpandToDeviceArrangement
(
*
expanded_shape_ptr
);
if
(
exchanged_out
==
nullptr
)
{
return
nullptr
;
}
return
exchanged_out
->
ExchangeFromAndTo
();
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录