Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
magicwindyyd
mindspore
提交
dffbe1c8
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看板
提交
dffbe1c8
编写于
5月 19, 2020
作者:
M
mindspore-ci-bot
提交者:
Gitee
5月 19, 2020
浏览文件
操作
浏览文件
下载
差异文件
!1234 [AutoParallel] maximize element-wise operators parallelism
Merge pull request !1234 from Chong/support_squeeze_and_reduce
上级
2aa78e7c
d84ccfe8
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
74 addition
and
9 deletion
+74
-9
mindspore/ccsrc/parallel/auto_parallel/rec_core/rec_generate_strategy.cc
.../parallel/auto_parallel/rec_core/rec_generate_strategy.cc
+19
-0
mindspore/ccsrc/parallel/auto_parallel/rec_core/rec_parse_graph.h
...e/ccsrc/parallel/auto_parallel/rec_core/rec_parse_graph.h
+55
-9
未找到文件。
mindspore/ccsrc/parallel/auto_parallel/rec_core/rec_generate_strategy.cc
浏览文件 @
dffbe1c8
...
...
@@ -421,6 +421,20 @@ std::vector<std::vector<int32_t>> GenerateStrategiesFromStrategy(const std::vect
if
(
ops
[
iter_ops
]
->
type
()
==
ONEHOT
)
{
return
PrepareOneHot
(
s
);
}
auto
dev_num
=
g_device_manager
->
DeviceNum
();
size_t
cut_num
=
1
;
for
(
size_t
i
=
0
;
i
<
s
.
size
();
i
++
)
{
cut_num
*=
s
[
i
];
}
if
(
cut_num
<
dev_num
)
{
size_t
diff
=
dev_num
/
cut_num
;
if
(
s
[
0
]
*
diff
>
dev_num
)
{
MS_LOG
(
EXCEPTION
)
<<
"Failure: Can not continue to partition in the N-dimension of the element-wise operator."
;
}
s
[
0
]
=
s
[
0
]
*
diff
;
}
for
(
size_t
i
=
0
;
i
<
(
size_t
)
ops
[
iter_ops
]
->
inputs_tensor_info
().
size
();
i
++
)
{
if
(
ops
[
iter_ops
]
->
inputs_tensor_info
()[
i
].
shape
().
size
()
==
0
)
{
stra
.
push_back
(
s_empty
);
...
...
@@ -537,6 +551,11 @@ void GenerateEliminatedOperatorStrategyBackward(const std::vector<std::shared_pt
auto
iter_ops
=
no_stra_op_list
->
at
(
iter_list
);
std
::
vector
<
std
::
vector
<
int32_t
>>
stra
;
std
::
vector
<
int32_t
>
s
=
CopyOutgoingOperatorInputStrategy
(
ops
,
input_tensor_names
,
iter_ops
);
if
(
s
.
size
()
==
0
)
{
for
(
size_t
i
=
0
;
i
<
ops
[
iter_ops
]
->
inputs_tensor_info
()[
0
].
shape
().
size
();
i
++
)
{
s
.
push_back
(
1
);
}
}
if
(
ops
[
iter_ops
]
->
type
()
==
SQUEEZE
)
{
s
=
ModifyStrategyIfSqueezeOutgoing
(
ops
,
iter_ops
,
s
);
}
...
...
mindspore/ccsrc/parallel/auto_parallel/rec_core/rec_parse_graph.h
浏览文件 @
dffbe1c8
...
...
@@ -34,26 +34,72 @@ const std::map<std::string, OperatorType> DictOpType{
{
MAXPOOL
,
OperatorType
::
kRecPooling
},
{
MAXPOOLV2
,
OperatorType
::
kRecPooling
},
{
SIMPLE_MEAN
,
OperatorType
::
kRecPooling
},
{
TENSOR_ADD
,
OperatorType
::
kRecElmWiseOp
},
{
RESHAPE
,
OperatorType
::
kRecReshape
},
{
BIAS_ADD
,
OperatorType
::
kRecBiasAdd
},
{
RELU
,
OperatorType
::
kRecReLU
},
{
BATCH_NORM
,
OperatorType
::
kRecBatchNorm
},
{
FUSE_BATCH_NORM
,
OperatorType
::
kRecBatchNorm
},
{
SOFTMAX_CROSS_ENTROPY_WITH_LOGITS
,
OperatorType
::
kRecSparseSoftmaxCrossEntropyWithLogits
},
{
SPARSE_SOFTMAX_CROSS_ENTROPY_WITH_LOGITS
,
OperatorType
::
kRecSparseSoftmaxCrossEntropyWithLogits
},
{
ONEHOT
,
OperatorType
::
kRecOneHot
},
{
LOG
,
OperatorType
::
kRecLog
},
{
EXP
,
OperatorType
::
kRecExp
},
{
SUB
,
OperatorType
::
kRecElmWiseOp
},
{
MUL
,
OperatorType
::
kRecElmWiseOp
},
{
DIV
,
OperatorType
::
kRecElmWiseOp
},
{
SQUEEZE
,
OperatorType
::
kRecSqueeze
},
{
CAST
,
OperatorType
::
kRecCast
},
{
REDUCE_SUM
,
OperatorType
::
kRecReduce
},
{
REDUCE_MAX
,
OperatorType
::
kRecReduce
},
{
REDUCE_MIN
,
OperatorType
::
kRecReduce
},
{
REDUCE_MEAN
,
OperatorType
::
kRecReduce
}};
{
REDUCE_MEAN
,
OperatorType
::
kRecReduce
},
{
RELU
,
OperatorType
::
kRecReLU
},
{
"ReLU6"
,
OperatorType
::
kRecReLU
},
{
"ReLUV2"
,
OperatorType
::
kRecReLU
},
{
SIGMOID
,
OperatorType
::
kRecReLU
},
{
SIGMOID_CROSS_ENTROPY_WITH_LOGITS
,
OperatorType
::
kRecReLU
},
{
"HSigmoid"
,
OperatorType
::
kRecReLU
},
{
GELU
,
OperatorType
::
kRecReLU
},
{
TANH
,
OperatorType
::
kRecReLU
},
{
TENSOR_ADD
,
OperatorType
::
kRecElmWiseOp
},
{
SUB
,
OperatorType
::
kRecElmWiseOp
},
{
MUL
,
OperatorType
::
kRecElmWiseOp
},
{
DIV
,
OperatorType
::
kRecElmWiseOp
},
{
REAL_DIV
,
OperatorType
::
kRecElmWiseOp
},
{
SOFTMAX
,
OperatorType
::
kRecElmWiseOp
},
{
LOG_SOFTMAX
,
OperatorType
::
kRecElmWiseOp
},
{
SOFTMAX_CROSS_ENTROPY_WITH_LOGITS
,
OperatorType
::
kRecElmWiseOp
},
{
SQRT
,
OperatorType
::
kRecElmWiseOp
},
{
NEG
,
OperatorType
::
kRecElmWiseOp
},
{
POW
,
OperatorType
::
kRecElmWiseOp
},
{
EXP
,
OperatorType
::
kRecElmWiseOp
},
{
LOG
,
OperatorType
::
kRecElmWiseOp
},
{
COS
,
OperatorType
::
kRecElmWiseOp
},
{
ACOS
,
OperatorType
::
kRecElmWiseOp
},
{
LOGICALNOT
,
OperatorType
::
kRecElmWiseOp
},
{
"LogicalAnd"
,
OperatorType
::
kRecElmWiseOp
},
{
"LogicalOr"
,
OperatorType
::
kRecElmWiseOp
},
{
SQUARE
,
OperatorType
::
kRecElmWiseOp
},
{
"Abs"
,
OperatorType
::
kRecElmWiseOp
},
{
"Acosh"
,
OperatorType
::
kRecElmWiseOp
},
{
"AddN"
,
OperatorType
::
kRecElmWiseOp
},
{
"Atan2"
,
OperatorType
::
kRecElmWiseOp
},
{
"Erf"
,
OperatorType
::
kRecElmWiseOp
},
{
"Floor"
,
OperatorType
::
kRecElmWiseOp
},
{
FLOORDIV
,
OperatorType
::
kRecElmWiseOp
},
{
"FloorMod"
,
OperatorType
::
kRecElmWiseOp
},
{
GREATER
,
OperatorType
::
kRecElmWiseOp
},
{
"GreaterEqual"
,
OperatorType
::
kRecElmWiseOp
},
{
"HSwish"
,
OperatorType
::
kRecElmWiseOp
},
{
"Less"
,
OperatorType
::
kRecElmWiseOp
},
{
"LessEqual"
,
OperatorType
::
kRecElmWiseOp
},
{
MAXIMUM
,
OperatorType
::
kRecElmWiseOp
},
{
MINIMUM
,
OperatorType
::
kRecElmWiseOp
},
{
EQUAL
,
OperatorType
::
kRecElmWiseOp
},
{
NOT_EQUAL
,
OperatorType
::
kRecElmWiseOp
},
{
"Reciprocal"
,
OperatorType
::
kRecElmWiseOp
},
{
"Round"
,
OperatorType
::
kRecElmWiseOp
},
{
"Rsqrt"
,
OperatorType
::
kRecElmWiseOp
},
{
"Sign"
,
OperatorType
::
kRecElmWiseOp
},
{
"Sin"
,
OperatorType
::
kRecElmWiseOp
},
{
ASSIGN
,
OperatorType
::
kRecElmWiseOp
},
{
ASSIGN_SUB
,
OperatorType
::
kRecElmWiseOp
},
{
"AssignAdd"
,
OperatorType
::
kRecElmWiseOp
}};
const
TensorParam
MakeTensor
(
int
n
,
int
c
,
int
h
,
int
w
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录