Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
magicwindyyd
mindspore
提交
80ed2e1a
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看板
提交
80ed2e1a
编写于
8月 17, 2020
作者:
L
lyvette
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
modify depthwise_conv tflite parser and conv-related model
上级
c7f461ac
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
32 addition
and
19 deletion
+32
-19
mindspore/lite/test/ut/tools/converter/parser/tflite/test_data/conv.tflite
...st/ut/tools/converter/parser/tflite/test_data/conv.tflite
+0
-0
mindspore/lite/test/ut/tools/converter/parser/tflite/test_data/deconv.tflite
.../ut/tools/converter/parser/tflite/test_data/deconv.tflite
+0
-0
mindspore/lite/test/ut/tools/converter/parser/tflite/test_data/depthwise_conv1.tflite
.../converter/parser/tflite/test_data/depthwise_conv1.tflite
+0
-0
mindspore/lite/test/ut/tools/converter/parser/tflite/test_data/depthwise_conv2.tflite
.../converter/parser/tflite/test_data/depthwise_conv2.tflite
+0
-0
mindspore/lite/test/ut/tools/converter/parser/tflite/tflite_conv_parser_test.cc
.../tools/converter/parser/tflite/tflite_conv_parser_test.cc
+3
-4
mindspore/lite/test/ut/tools/converter/parser/tflite/tflite_deconv_parser_test.cc
...ools/converter/parser/tflite/tflite_deconv_parser_test.cc
+3
-4
mindspore/lite/test/ut/tools/converter/parser/tflite/tflite_depthwise_conv_parser_test.cc
...verter/parser/tflite/tflite_depthwise_conv_parser_test.cc
+6
-8
mindspore/lite/tools/converter/parser/tflite/tflite_model_parser.cc
...lite/tools/converter/parser/tflite/tflite_model_parser.cc
+20
-3
未找到文件。
mindspore/lite/test/ut/tools/converter/parser/tflite/test_data/conv.tflite
浏览文件 @
80ed2e1a
无法预览此类型文件
mindspore/lite/test/ut/tools/converter/parser/tflite/test_data/deconv.tflite
浏览文件 @
80ed2e1a
无法预览此类型文件
mindspore/lite/test/ut/tools/converter/parser/tflite/test_data/depthwise_conv1.tflite
浏览文件 @
80ed2e1a
无法预览此类型文件
mindspore/lite/test/ut/tools/converter/parser/tflite/test_data/depthwise_conv2.tflite
浏览文件 @
80ed2e1a
无法预览此类型文件
mindspore/lite/test/ut/tools/converter/parser/tflite/tflite_conv_parser_test.cc
浏览文件 @
80ed2e1a
...
...
@@ -28,13 +28,12 @@ TEST_F(TestTfliteParserConv, OpType) {
ASSERT_NE
(
meta_graph
,
nullptr
);
ASSERT_GT
(
meta_graph
->
nodes
.
size
(),
0
);
ASSERT_NE
(
meta_graph
->
nodes
.
front
()
->
primitive
.
get
(),
nullptr
);
ASSERT_EQ
(
meta_graph
->
nodes
.
front
()
->
primitive
->
value
.
type
,
schema
::
PrimitiveType_Transpose
)
<<
"wrong Op Type"
;
ASSERT_EQ
(
meta_graph
->
nodes
.
at
(
1
)
->
primitive
->
value
.
type
,
schema
::
PrimitiveType_Conv2D
)
<<
"wrong Op Type"
;
ASSERT_EQ
(
meta_graph
->
nodes
.
front
()
->
primitive
->
value
.
type
,
schema
::
PrimitiveType_Conv2D
)
<<
"wrong Op Type"
;
}
TEST_F
(
TestTfliteParserConv
,
AttrValue
)
{
ASSERT_NE
(
meta_graph
->
nodes
.
at
(
1
)
->
primitive
->
value
.
AsConv2D
(),
nullptr
);
auto
val
=
meta_graph
->
nodes
.
at
(
1
)
->
primitive
->
value
.
AsConv2D
();
ASSERT_NE
(
meta_graph
->
nodes
.
front
(
)
->
primitive
->
value
.
AsConv2D
(),
nullptr
);
auto
val
=
meta_graph
->
nodes
.
front
(
)
->
primitive
->
value
.
AsConv2D
();
ASSERT_EQ
(
val
->
format
,
schema
::
Format_NHWC
);
ASSERT_EQ
(
val
->
group
,
1
);
ASSERT_EQ
(
val
->
activationType
,
schema
::
ActivationType_NO_ACTIVATION
);
...
...
mindspore/lite/test/ut/tools/converter/parser/tflite/tflite_deconv_parser_test.cc
浏览文件 @
80ed2e1a
...
...
@@ -28,13 +28,12 @@ TEST_F(TestTfliteParserDeConv, OpType) {
ASSERT_NE
(
meta_graph
,
nullptr
);
ASSERT_GT
(
meta_graph
->
nodes
.
size
(),
0
);
ASSERT_NE
(
meta_graph
->
nodes
.
front
()
->
primitive
.
get
(),
nullptr
);
ASSERT_EQ
(
meta_graph
->
nodes
.
front
()
->
primitive
->
value
.
type
,
schema
::
PrimitiveType_Transpose
)
<<
"wrong Op Type"
;
ASSERT_EQ
(
meta_graph
->
nodes
.
at
(
1
)
->
primitive
->
value
.
type
,
schema
::
PrimitiveType_DeConv2D
)
<<
"wrong Op Type"
;
ASSERT_EQ
(
meta_graph
->
nodes
.
front
()
->
primitive
->
value
.
type
,
schema
::
PrimitiveType_DeConv2D
)
<<
"wrong Op Type"
;
}
TEST_F
(
TestTfliteParserDeConv
,
AttrValue
)
{
ASSERT_NE
(
meta_graph
->
nodes
.
at
(
1
)
->
primitive
->
value
.
AsDeConv2D
(),
nullptr
);
auto
val
=
meta_graph
->
nodes
.
at
(
1
)
->
primitive
->
value
.
AsDeConv2D
();
ASSERT_NE
(
meta_graph
->
nodes
.
front
(
)
->
primitive
->
value
.
AsDeConv2D
(),
nullptr
);
auto
val
=
meta_graph
->
nodes
.
front
(
)
->
primitive
->
value
.
AsDeConv2D
();
ASSERT_EQ
(
val
->
format
,
schema
::
Format_NHWC
);
ASSERT_EQ
(
val
->
group
,
1
);
ASSERT_EQ
(
val
->
activationType
,
schema
::
ActivationType_NO_ACTIVATION
);
...
...
mindspore/lite/test/ut/tools/converter/parser/tflite/tflite_depthwise_conv_parser_test.cc
浏览文件 @
80ed2e1a
...
...
@@ -28,13 +28,12 @@ TEST_F(TestTfliteParserDepthwiseConv1, OpType) {
ASSERT_NE
(
meta_graph
,
nullptr
);
ASSERT_GT
(
meta_graph
->
nodes
.
size
(),
0
);
ASSERT_NE
(
meta_graph
->
nodes
.
front
()
->
primitive
.
get
(),
nullptr
);
ASSERT_EQ
(
meta_graph
->
nodes
.
front
()
->
primitive
->
value
.
type
,
schema
::
PrimitiveType_Reshape
)
<<
"wrong Op Type"
;
ASSERT_EQ
(
meta_graph
->
nodes
.
at
(
1
)
->
primitive
->
value
.
type
,
schema
::
PrimitiveType_Conv2D
)
<<
"wrong Op Type"
;
ASSERT_EQ
(
meta_graph
->
nodes
.
front
()
->
primitive
->
value
.
type
,
schema
::
PrimitiveType_Conv2D
)
<<
"wrong Op Type"
;
}
TEST_F
(
TestTfliteParserDepthwiseConv1
,
AttrValue
)
{
ASSERT_NE
(
meta_graph
->
nodes
.
at
(
1
)
->
primitive
->
value
.
AsConv2D
(),
nullptr
);
auto
val
=
meta_graph
->
nodes
.
at
(
1
)
->
primitive
->
value
.
AsConv2D
();
ASSERT_NE
(
meta_graph
->
nodes
.
front
(
)
->
primitive
->
value
.
AsConv2D
(),
nullptr
);
auto
val
=
meta_graph
->
nodes
.
front
(
)
->
primitive
->
value
.
AsConv2D
();
ASSERT_EQ
(
val
->
format
,
schema
::
Format_NHWC
);
ASSERT_EQ
(
val
->
group
,
0
);
ASSERT_EQ
(
val
->
activationType
,
schema
::
ActivationType_NO_ACTIVATION
);
...
...
@@ -64,13 +63,12 @@ TEST_F(TestTfliteParserDepthwiseConv2, OpType) {
ASSERT_NE
(
meta_graph
,
nullptr
);
ASSERT_GT
(
meta_graph
->
nodes
.
size
(),
0
);
ASSERT_NE
(
meta_graph
->
nodes
.
front
()
->
primitive
.
get
(),
nullptr
);
ASSERT_EQ
(
meta_graph
->
nodes
.
front
()
->
primitive
->
value
.
type
,
schema
::
PrimitiveType_Reshape
)
<<
"wrong Op Type"
;
ASSERT_EQ
(
meta_graph
->
nodes
.
at
(
1
)
->
primitive
->
value
.
type
,
schema
::
PrimitiveType_DepthwiseConv2D
)
<<
"wrong Op Type"
;
ASSERT_EQ
(
meta_graph
->
nodes
.
front
()
->
primitive
->
value
.
type
,
schema
::
PrimitiveType_DepthwiseConv2D
)
<<
"wrong Op Type"
;
}
TEST_F
(
TestTfliteParserDepthwiseConv2
,
AttrValue
)
{
ASSERT_NE
(
meta_graph
->
nodes
.
at
(
1
)
->
primitive
->
value
.
AsDepthwiseConv2D
(),
nullptr
);
auto
val
=
meta_graph
->
nodes
.
at
(
1
)
->
primitive
->
value
.
AsDepthwiseConv2D
();
ASSERT_NE
(
meta_graph
->
nodes
.
front
(
)
->
primitive
->
value
.
AsDepthwiseConv2D
(),
nullptr
);
auto
val
=
meta_graph
->
nodes
.
front
(
)
->
primitive
->
value
.
AsDepthwiseConv2D
();
ASSERT_EQ
(
val
->
format
,
schema
::
Format_NHWC
);
ASSERT_EQ
(
val
->
activationType
,
schema
::
ActivationType_NO_ACTIVATION
);
ASSERT_EQ
(
val
->
hasBias
,
true
);
...
...
mindspore/lite/tools/converter/parser/tflite/tflite_model_parser.cc
浏览文件 @
80ed2e1a
...
...
@@ -222,12 +222,29 @@ STATUS TfliteModelParser::UpdateOp(schema::MetaGraphT* sub_graph) {
if
(
op
->
primitive
->
value
.
type
==
schema
::
PrimitiveType_DepthwiseConv2D
)
{
auto
attr
=
op
->
primitive
->
value
.
AsDepthwiseConv2D
();
if
(
attr
->
channelMultiplier
>
1
)
{
// update attr
std
::
unique_ptr
<
schema
::
Conv2DT
>
conv_attr
(
new
schema
::
Conv2DT
);
// get channel attr
if
(
op
->
inputIndex
.
empty
())
{
MS_LOG
(
ERROR
)
<<
"the input of DepthwiseConv2D is null"
;
return
RET_NULL_PTR
;
}
auto
data_id
=
op
->
inputIndex
[
0
];
if
(
sub_graph
->
allTensors
.
size
()
<=
data_id
)
{
MS_LOG
(
ERROR
)
<<
"the number of allTensors is less than "
<<
data_id
;
return
RET_ERROR
;
}
auto
&
data_tensor
=
sub_graph
->
allTensors
.
at
(
data_id
);
if
(
data_tensor
==
nullptr
)
{
MS_LOG
(
ERROR
)
<<
"the data tensor is null"
;
return
RET_NULL_PTR
;
}
auto
data_shape
=
data_tensor
->
dims
;
conv_attr
->
channelIn
=
data_shape
[
3
];
conv_attr
->
channelOut
=
conv_attr
->
channelIn
*
attr
->
channelMultiplier
;
// update attr
conv_attr
->
group
=
0
;
conv_attr
->
format
=
attr
->
format
;
conv_attr
->
channelIn
=
attr
->
channelIn
;
conv_attr
->
channelOut
=
attr
->
channelIn
*
attr
->
channelMultiplier
;
conv_attr
->
kernelH
=
attr
->
kernelH
;
conv_attr
->
kernelW
=
attr
->
kernelW
;
conv_attr
->
strideH
=
attr
->
strideH
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录