Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
magicwindyyd
mindspore
提交
dda115c0
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看板
提交
dda115c0
编写于
4年前
作者:
M
mindspore-ci-bot
提交者:
Gitee
4年前
浏览文件
操作
浏览文件
下载
差异文件
!5145 modify caffe relu6 & tanh parser format
Merge pull request !5145 from lyvette/parser
上级
84592a9f
312f247c
master
无相关合并请求
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
54 addition
and
15 deletion
+54
-15
mindspore/lite/tools/converter/parser/caffe/caffe_relu6_parser.cc
...e/lite/tools/converter/parser/caffe/caffe_relu6_parser.cc
+24
-5
mindspore/lite/tools/converter/parser/caffe/caffe_relu6_parser.h
...re/lite/tools/converter/parser/caffe/caffe_relu6_parser.h
+6
-4
mindspore/lite/tools/converter/parser/caffe/caffe_tanh_parser.cc
...re/lite/tools/converter/parser/caffe/caffe_tanh_parser.cc
+18
-2
mindspore/lite/tools/converter/parser/caffe/caffe_tanh_parser.h
...ore/lite/tools/converter/parser/caffe/caffe_tanh_parser.h
+6
-4
未找到文件。
mindspore/lite/tools/converter/parser/caffe/caffe_relu6_parser.cc
浏览文件 @
dda115c0
...
...
@@ -14,14 +14,32 @@
* limitations under the License.
*/
#include <memory>
#include "mindspore/lite/tools/converter/parser/caffe/caffe_relu6_parser.h"
#include <memory>
namespace
mindspore
{
namespace
lite
{
STATUS
CaffeRelu6Parser
::
Parse
(
const
caffe
::
LayerParameter
&
proto
,
const
caffe
::
LayerParameter
&
weight
,
schema
::
CNodeT
*
op
,
std
::
vector
<
schema
::
TensorT
*>
*
weightVec
)
{
STATUS
CaffeRelu6Parser
::
Parse
(
const
caffe
::
LayerParameter
&
proto
,
const
caffe
::
LayerParameter
&
weight
,
schema
::
CNodeT
*
op
,
std
::
vector
<
schema
::
TensorT
*>
*
weightVec
)
{
MS_LOG
(
DEBUG
)
<<
"parse CaffeRelu6Parser"
;
if
(
op
==
nullptr
)
{
MS_LOG
(
ERROR
)
<<
"op is null"
;
return
RET_NULL_PTR
;
}
op
->
primitive
=
std
::
make_unique
<
schema
::
PrimitiveT
>
();
if
(
op
->
primitive
==
nullptr
)
{
MS_LOG
(
ERROR
)
<<
"op->primitive is null"
;
return
RET_NULL_PTR
;
}
std
::
unique_ptr
<
schema
::
ActivationT
>
attr
(
new
schema
::
ActivationT
());
if
(
attr
==
nullptr
)
{
MS_LOG
(
ERROR
)
<<
"new op failed"
;
return
RET_NULL_PTR
;
}
attr
->
type
=
schema
::
ActivationType_RELU6
;
// relu: negative_slope = 0, no parameter;
// leakyrelu: negative_slope != 0;
...
...
@@ -32,9 +50,10 @@ STATUS CaffeRelu6Parser::Parse(const caffe::LayerParameter &proto, const caffe::
attr
->
alpha
=
negative_slope
;
}
}
op
->
primitive
=
std
::
make_unique
<
schema
::
PrimitiveT
>
();
op
->
primitive
->
value
.
value
=
attr
.
releas
e
();
op
->
name
=
proto
.
nam
e
();
op
->
primitive
->
value
.
type
=
schema
::
PrimitiveType_Activation
;
op
->
primitive
->
value
.
value
=
attr
.
release
();
return
RET_OK
;
}
...
...
This diff is collapsed.
Click to expand it.
mindspore/lite/tools/converter/parser/caffe/caffe_relu6_parser.h
浏览文件 @
dda115c0
...
...
@@ -13,8 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef MINDSPORE_
CCSRC_TOOLS_LITE
_CONVERTER_PARSER_CAFFE_CAFFE_RELU6_PARSER_H_
#define MINDSPORE_
CCSRC_TOOLS_LITE
_CONVERTER_PARSER_CAFFE_CAFFE_RELU6_PARSER_H_
#ifndef MINDSPORE_
LITE_TOOLS
_CONVERTER_PARSER_CAFFE_CAFFE_RELU6_PARSER_H_
#define MINDSPORE_
LITE_TOOLS
_CONVERTER_PARSER_CAFFE_CAFFE_RELU6_PARSER_H_
#include <vector>
#include "mindspore/lite/tools/converter/parser/caffe/caffe_node_parser.h"
...
...
@@ -26,10 +26,12 @@ class CaffeRelu6Parser : public CaffeNodeParser {
public:
CaffeRelu6Parser
()
:
CaffeNodeParser
(
"relu6"
)
{}
STATUS
Parse
(
const
caffe
::
LayerParameter
&
proto
,
const
caffe
::
LayerParameter
&
weight
,
schema
::
CNodeT
*
op
,
STATUS
Parse
(
const
caffe
::
LayerParameter
&
proto
,
const
caffe
::
LayerParameter
&
weight
,
schema
::
CNodeT
*
op
,
std
::
vector
<
schema
::
TensorT
*>
*
weightVec
)
override
;
};
}
// namespace lite
}
// namespace mindspore
#endif // MINDSPORE_
CCSRC_TOOLS_LITE_CONVERTER_PARSER_CAFFE_CAFFE_RELU
_PARSER_H_
#endif // MINDSPORE_
LITE_TOOLS_CONVERTER_PARSER_CAFFE_CAFFE_RELU6
_PARSER_H_
This diff is collapsed.
Click to expand it.
mindspore/lite/tools/converter/parser/caffe/caffe_tanh_parser.cc
浏览文件 @
dda115c0
...
...
@@ -24,11 +24,27 @@ STATUS CaffeTanhParser::Parse(const caffe::LayerParameter &proto,
const
caffe
::
LayerParameter
&
weight
,
schema
::
CNodeT
*
op
,
std
::
vector
<
schema
::
TensorT
*>
*
weightVec
)
{
MS_LOG
(
DEBUG
)
<<
"parse CaffeTanhParser"
;
if
(
op
==
nullptr
)
{
MS_LOG
(
ERROR
)
<<
"op is null"
;
return
RET_NULL_PTR
;
}
op
->
primitive
=
std
::
make_unique
<
schema
::
PrimitiveT
>
();
if
(
op
->
primitive
==
nullptr
)
{
MS_LOG
(
ERROR
)
<<
"op->primitive is null"
;
return
RET_NULL_PTR
;
}
std
::
unique_ptr
<
schema
::
ActivationT
>
attr
(
new
schema
::
ActivationT
());
if
(
attr
==
nullptr
)
{
MS_LOG
(
ERROR
)
<<
"new op failed"
;
return
RET_NULL_PTR
;
}
attr
->
type
=
schema
::
ActivationType_TANH
;
op
->
primitive
=
std
::
make_unique
<
schema
::
PrimitiveT
>
();
op
->
primitive
->
value
.
value
=
attr
.
releas
e
();
op
->
name
=
proto
.
nam
e
();
op
->
primitive
->
value
.
type
=
schema
::
PrimitiveType_Activation
;
op
->
primitive
->
value
.
value
=
attr
.
release
();
return
RET_OK
;
}
...
...
This diff is collapsed.
Click to expand it.
mindspore/lite/tools/converter/parser/caffe/caffe_tanh_parser.h
浏览文件 @
dda115c0
...
...
@@ -14,8 +14,8 @@
* limitations under the License.
*/
#ifndef
LIT
E_CAFFE_TANH_PARSER_H
#define
LIT
E_CAFFE_TANH_PARSER_H
#ifndef
MINDSPORE_LITE_TOOLS_CONVERTER_PARSER_CAFF
E_CAFFE_TANH_PARSER_H
#define
MINDSPORE_LITE_TOOLS_CONVERTER_PARSER_CAFF
E_CAFFE_TANH_PARSER_H
#include <vector>
#include "tools/converter/parser/caffe/caffe_node_parser.h"
...
...
@@ -27,10 +27,12 @@ class CaffeTanhParser : public CaffeNodeParser {
public:
CaffeTanhParser
()
:
CaffeNodeParser
(
"tanh"
)
{}
STATUS
Parse
(
const
caffe
::
LayerParameter
&
proto
,
const
caffe
::
LayerParameter
&
weight
,
schema
::
CNodeT
*
op
,
STATUS
Parse
(
const
caffe
::
LayerParameter
&
proto
,
const
caffe
::
LayerParameter
&
weight
,
schema
::
CNodeT
*
op
,
std
::
vector
<
schema
::
TensorT
*>
*
weightVec
)
override
;
};
}
// namespace lite
}
// namespace mindspore
#endif //
LIT
E_CAFFE_TANH_PARSER_H
#endif //
MINDSPORE_LITE_TOOLS_CONVERTER_PARSER_CAFF
E_CAFFE_TANH_PARSER_H
This diff is collapsed.
Click to expand it.
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录
反馈
建议
客服
返回
顶部