Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
magicwindyyd
mindspore
提交
68aca9ab
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看板
提交
68aca9ab
编写于
5月 21, 2020
作者:
L
liuxiao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
UnsortedSegmentMinD->UnsortedSegmentMin
上级
d9c74e0a
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
10 addition
and
10 deletion
+10
-10
mindspore/ccsrc/transform/convert.cc
mindspore/ccsrc/transform/convert.cc
+1
-1
mindspore/ccsrc/transform/op_declare.cc
mindspore/ccsrc/transform/op_declare.cc
+3
-4
mindspore/ccsrc/transform/op_declare.h
mindspore/ccsrc/transform/op_declare.h
+2
-3
mindspore/ops/operations/array_ops.py
mindspore/ops/operations/array_ops.py
+4
-2
未找到文件。
mindspore/ccsrc/transform/convert.cc
浏览文件 @
68aca9ab
...
...
@@ -343,7 +343,7 @@ std::unordered_map<std::string, OpAdapterDescPtr> &DfGraphConvertor::get_adpt_ma
{
prim
::
kPrimGelu
->
name
(),
ADPT_DESC
(
Gelu
)},
{
prim
::
kPrimGeluGrad
->
name
(),
ADPT_DESC
(
GeluGrad
)},
{
string
(
kNameStridedSlice
),
ADPT_DESC
(
StridedSlice
)},
{
prim
::
kPrimUnsortedSegmentMin
->
name
(),
ADPT_DESC
(
UnsortedSegmentMin
D
)},
{
prim
::
kPrimUnsortedSegmentMin
->
name
(),
ADPT_DESC
(
UnsortedSegmentMin
)},
{
prim
::
kPrimUnsortedSegmentSum
->
name
(),
ADPT_DESC
(
UnsortedSegmentSumD
)},
{
string
(
kNameExpandDims
),
ADPT_DESC
(
ExpandDims
)},
{
prim
::
kPrimSqueeze
->
name
(),
ADPT_DESC
(
Squeeze
)},
...
...
mindspore/ccsrc/transform/op_declare.cc
浏览文件 @
68aca9ab
...
...
@@ -1059,10 +1059,9 @@ ATTR_MAP(UnsortedSegmentSumD) = EMPTY_ATTR_MAP;
OUTPUT_MAP
(
UnsortedSegmentSumD
)
=
{{
0
,
OUTPUT_DESC
(
y
)}};
// UnsortedSegmentMin
INPUT_MAP
(
UnsortedSegmentMinD
)
=
{{
1
,
INPUT_DESC
(
x
)},
{
2
,
INPUT_DESC
(
segment_ids
)}};
INPUT_ATTR_MAP
(
UnsortedSegmentMinD
)
=
{{
3
,
ATTR_DESC
(
num_segments
,
AnyTraits
<
int64_t
>
())}};
ATTR_MAP
(
UnsortedSegmentMinD
)
=
EMPTY_ATTR_MAP
;
OUTPUT_MAP
(
UnsortedSegmentMinD
)
=
{{
0
,
OUTPUT_DESC
(
y
)}};
INPUT_MAP
(
UnsortedSegmentMin
)
=
{{
1
,
INPUT_DESC
(
x
)},
{
2
,
INPUT_DESC
(
segment_ids
)},
{
3
,
INPUT_DESC
(
num_segments
)}};
ATTR_MAP
(
UnsortedSegmentMin
)
=
EMPTY_ATTR_MAP
;
OUTPUT_MAP
(
UnsortedSegmentMin
)
=
{{
0
,
OUTPUT_DESC
(
y
)}};
// ExpandDims
INPUT_MAP
(
ExpandDims
)
=
{{
1
,
INPUT_DESC
(
x
)},
{
2
,
INPUT_DESC
(
axis
)}};
...
...
mindspore/ccsrc/transform/op_declare.h
浏览文件 @
68aca9ab
...
...
@@ -285,9 +285,8 @@ DECLARE_OP_USE_OUTPUT(StridedSlice)
DECLARE_OP_ADAPTER
(
UnsortedSegmentSumD
)
DECLARE_OP_USE_INPUT_ATTR
(
UnsortedSegmentSumD
)
DECLARE_OP_USE_OUTPUT
(
UnsortedSegmentSumD
)
DECLARE_OP_ADAPTER
(
UnsortedSegmentMinD
)
DECLARE_OP_USE_INPUT_ATTR
(
UnsortedSegmentMinD
)
DECLARE_OP_USE_OUTPUT
(
UnsortedSegmentMinD
)
DECLARE_OP_ADAPTER
(
UnsortedSegmentMin
)
DECLARE_OP_USE_OUTPUT
(
UnsortedSegmentMin
)
DECLARE_OP_ADAPTER
(
ExpandDims
)
DECLARE_OP_USE_OUTPUT
(
ExpandDims
)
DECLARE_OP_ADAPTER
(
Squeeze
)
...
...
mindspore/ops/operations/array_ops.py
浏览文件 @
68aca9ab
...
...
@@ -1271,7 +1271,7 @@ class UnsortedSegmentMin(PrimitiveWithInfer):
Inputs:
- **input_x** (Tensor) - The shape is :math:`(x_1, x_2, ..., x_R)`.
- **segment_ids** (Tensor) - A `1-D` tensor whose shape is
a prefix of `x_shape
`.
- **segment_ids** (Tensor) - A `1-D` tensor whose shape is
:math:`(x_1)
`.
- **num_segments** (int) - The value spcifies the number of distinct `segment_ids`.
Outputs:
...
...
@@ -1279,7 +1279,7 @@ class UnsortedSegmentMin(PrimitiveWithInfer):
Examples:
>>> input_x = Tensor(np.array([[1, 2, 3], [4, 5, 6], [4, 2, 1]]).astype(np.float32))
>>> segment_ids = Tensor(np.array([0, 1, 1]).
np.int32
)
>>> segment_ids = Tensor(np.array([0, 1, 1]).
astype(np.int32)
)
>>> num_segments = 2
>>> unsorted_segment_min = P.UnsortedSegmentMin()
>>> unsorted_segment_min(input_x, segment_ids, num_segments)
...
...
@@ -1299,6 +1299,8 @@ class UnsortedSegmentMin(PrimitiveWithInfer):
validator
.
check_tensor_type_same
({
"x"
:
x
[
'dtype'
]},
valid_type
,
self
.
name
)
validator
.
check_tensor_type_same
({
"segment_ids"
:
segment_ids
[
'dtype'
]},
[
mstype
.
int32
],
self
.
name
)
validator
.
check_integer
(
"rank of segment_ids_shape"
,
len
(
segment_ids_shape
),
1
,
Rel
.
EQ
,
self
.
name
)
validator
.
check
(
f
'first shape of input_x'
,
x_shape
[
0
],
'length of segments_id'
,
segment_ids_shape
[
0
],
Rel
.
EQ
,
self
.
name
)
num_segments_v
=
num_segments
[
'value'
]
validator
.
check_value_type
(
'num_segments'
,
num_segments_v
,
[
int
],
self
.
name
)
validator
.
check_integer
(
"num_segments"
,
num_segments_v
,
0
,
Rel
.
GT
,
self
.
name
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录