Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
magicwindyyd
mindspore
提交
577beb21
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看板
提交
577beb21
编写于
8月 31, 2020
作者:
M
mindspore-ci-bot
提交者:
Gitee
8月 31, 2020
浏览文件
操作
浏览文件
下载
差异文件
!5552 supplement softmax UnPackAttr
Merge pull request !5552 from lyvette/lite
上级
29b9e11b
a4617f66
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
33 addition
and
0 deletion
+33
-0
mindspore/lite/src/ops/primitive_c.cc
mindspore/lite/src/ops/primitive_c.cc
+2
-0
mindspore/lite/src/ops/softmax.cc
mindspore/lite/src/ops/softmax.cc
+30
-0
mindspore/lite/src/ops/softmax.h
mindspore/lite/src/ops/softmax.h
+1
-0
未找到文件。
mindspore/lite/src/ops/primitive_c.cc
浏览文件 @
577beb21
...
...
@@ -257,6 +257,8 @@ std::shared_ptr<PrimitiveC> PrimitiveC::UnPackFromPrimitive(const Primitive &pri
return
NewPrimitiveC
<
Transpose
>
(
prim
,
inputs
);
}
else
if
(
op_type
==
"tuple_getitem"
)
{
return
NewPrimitiveC
<
TupleGetItem
>
(
prim
,
inputs
);
}
else
if
(
op_type
==
"Softmax"
)
{
return
NewPrimitiveC
<
SoftMax
>
(
prim
,
inputs
);
}
else
{
MS_LOG
(
ERROR
)
<<
"Unsupported primitive type in UnPackFromPrimitive : "
<<
op_type
;
return
nullptr
;
...
...
mindspore/lite/src/ops/softmax.cc
浏览文件 @
577beb21
...
...
@@ -21,6 +21,36 @@ namespace lite {
#ifdef PRIMITIVE_WRITEABLE
int
SoftMax
::
GetAxis
()
const
{
return
this
->
primitive_
->
value
.
AsSoftMax
()
->
axis
;
}
int
SoftMax
::
UnPackAttr
(
const
Primitive
&
prim
,
const
std
::
vector
<
AnfNodePtr
>
&
inputs
)
{
if
(
this
->
primitive_
==
nullptr
)
{
this
->
primitive_
=
new
(
std
::
nothrow
)
schema
::
PrimitiveT
;
if
(
this
->
primitive_
==
nullptr
)
{
MS_LOG
(
ERROR
)
<<
"new primitiveT failed"
;
return
RET_ERROR
;
}
this
->
primitive_
->
value
.
type
=
schema
::
PrimitiveType_SoftMax
;
}
if
(
this
->
primitive_
->
value
.
type
!=
schema
::
PrimitiveType_SoftMax
)
{
MS_LOG
(
ERROR
)
<<
"Primitive type is error :"
<<
this
->
primitive_
->
value
.
type
;
return
RET_ERROR
;
}
if
(
this
->
primitive_
->
value
.
value
==
nullptr
)
{
auto
attr
=
new
(
std
::
nothrow
)
schema
::
SoftMaxT
();
if
(
attr
==
nullptr
)
{
MS_LOG
(
ERROR
)
<<
"new primitiveT value failed"
;
return
RET_ERROR
;
}
auto
prim_axis
=
GetValue
<
int
>
(
prim
.
GetAttr
(
"axis"
));
attr
->
axis
=
prim_axis
;
this
->
primitive_
->
value
.
value
=
attr
;
if
(
this
->
primitive_
->
value
.
value
==
nullptr
)
{
MS_LOG
(
ERROR
)
<<
"primitive value is nullptr"
;
return
RET_ERROR
;
}
}
return
RET_OK
;
}
void
SoftMax
::
SetAxis
(
int
axis
)
{
this
->
primitive_
->
value
.
AsSoftMax
()
->
axis
=
axis
;
}
#else
...
...
mindspore/lite/src/ops/softmax.h
浏览文件 @
577beb21
...
...
@@ -31,6 +31,7 @@ class SoftMax : public PrimitiveC {
MS_DECLARE_PARENT
(
SoftMax
,
PrimitiveC
);
SoftMax
()
=
default
;
explicit
SoftMax
(
schema
::
PrimitiveT
*
primitive
)
:
PrimitiveC
(
primitive
)
{}
int
UnPackAttr
(
const
Primitive
&
prim
,
const
std
::
vector
<
AnfNodePtr
>
&
inputs
)
override
;
void
SetAxis
(
int
axis
);
#else
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录