Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
正统之独孤求败
mindspore
提交
49fd9fa9
M
mindspore
项目概览
正统之独孤求败
/
mindspore
与 Fork 源项目一致
Fork自
MindSpore / mindspore
通知
1
Star
0
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
49fd9fa9
编写于
8月 13, 2020
作者:
M
mindspore-ci-bot
提交者:
Gitee
8月 13, 2020
浏览文件
操作
浏览文件
下载
差异文件
!4372 Modify the method for getting output index of metagraph.
Merge pull request !4372 from wangshaocong/lite
上级
a3036470
067beb25
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
28 addition
and
12 deletion
+28
-12
mindspore/lite/src/ops/reduce.cc
mindspore/lite/src/ops/reduce.cc
+1
-1
mindspore/lite/src/runtime/kernel/arm/fp32/reduce.cc
mindspore/lite/src/runtime/kernel/arm/fp32/reduce.cc
+1
-1
mindspore/lite/tools/converter/parser/tflite/tflite_model_parser.cc
...lite/tools/converter/parser/tflite/tflite_model_parser.cc
+22
-9
mindspore/lite/tools/converter/parser/tflite/tflite_model_parser.h
.../lite/tools/converter/parser/tflite/tflite_model_parser.h
+4
-1
未找到文件。
mindspore/lite/src/ops/reduce.cc
浏览文件 @
49fd9fa9
...
...
@@ -58,7 +58,7 @@ int Reduce::InferShape(std::vector<tensor::Tensor *> inputs_, std::vector<tensor
for
(
size_t
i
=
0
;
i
<
in_shape
.
size
();
i
++
)
{
bool
reduce_axis
=
false
;
for
(
int
idx
=
0
;
idx
<
num_axes
;
++
idx
)
{
if
(
static_cast
<
size_t
>
((
*
axes
)[
idx
])
==
i
)
{
if
(
static_cast
<
size_t
>
((
*
axes
)[
idx
])
==
i
||
static_cast
<
size_t
>
((
*
axes
)[
idx
]
+
in_shape
.
size
())
==
i
)
{
reduce_axis
=
true
;
break
;
}
...
...
mindspore/lite/src/runtime/kernel/arm/fp32/reduce.cc
浏览文件 @
49fd9fa9
...
...
@@ -71,7 +71,7 @@ int ReduceCPUKernel::CheckParameters() {
return
RET_ERROR
;
}
for
(
auto
i
=
0
;
i
<
num_axes_
;
i
++
)
{
if
(
axes_
[
i
]
<
-
static_cast
<
int
>
(
input_rank
)
||
static_cast
<
size_t
>
(
axes_
[
i
])
>=
input_rank
)
{
if
(
axes_
[
i
]
<
-
static_cast
<
int
>
(
input_rank
)
||
axes_
[
i
]
>=
static_cast
<
int
>
(
input_rank
)
)
{
MS_LOG
(
ERROR
)
<<
"Reduce got invalid axis "
<<
axes_
[
i
]
<<
", axis should be in ["
<<
-
static_cast
<
int
>
(
input_rank
)
<<
", "
<<
input_rank
-
1
<<
"]."
;
return
RET_ERROR
;
...
...
mindspore/lite/tools/converter/parser/tflite/tflite_model_parser.cc
浏览文件 @
49fd9fa9
...
...
@@ -236,18 +236,31 @@ void TfliteModelParser::SetInputTensor(const std::unique_ptr<tflite::SubGraphT>
}
}
void
TfliteModelParser
::
SetGraphTensorIndex
(
const
mindspore
::
lite
::
TensorCache
&
tensorCache
,
void
TfliteModelParser
::
SetGraphTensorIndex
(
const
std
::
unique_ptr
<
tflite
::
SubGraphT
>
&
tflite_subgraph
,
const
std
::
unique_ptr
<
tflite
::
ModelT
>
&
tflite_model
,
const
mindspore
::
lite
::
TensorCache
&
tensorCache
,
schema
::
MetaGraphT
*
subGraphDef
)
{
auto
opGraph
=
OpGraphT
::
Build
(
subGraphDef
);
auto
graphInputs
=
tensorCache
.
GetGraphInputs
();
auto
graphOutputs
=
opGraph
->
GetOutputNode
();
subGraphDef
->
inputIndex
.
assign
(
graphInputs
.
begin
(),
graphInputs
.
end
());
for
(
const
auto
&
output
:
graphOutputs
)
{
auto
op
=
opMap
[
output
->
ID
()];
for
(
auto
outputIndex
:
op
->
outputIndex
)
{
subGraphDef
->
outputIndex
.
emplace_back
(
outputIndex
);
for
(
auto
outputIndex
:
tflite_subgraph
->
outputs
)
{
int
i
=
0
;
bool
found
=
false
;
for
(
const
auto
&
tfliteOp
:
tflite_subgraph
->
operators
)
{
int
j
=
0
;
auto
opType
=
GetTfliteNodeType
(
tfliteOp
,
tflite_model
);
std
::
string
opName
=
opType
+
"-"
+
std
::
to_string
(
i
++
);
for
(
auto
opOutputIndex
:
tfliteOp
->
outputs
)
{
if
(
outputIndex
==
opOutputIndex
)
{
subGraphDef
->
outputIndex
.
emplace_back
(
opMap
[
opName
]
->
outputIndex
[
j
]);
found
=
true
;
break
;
}
j
++
;
}
if
(
found
)
{
break
;
}
}
}
}
...
...
@@ -284,7 +297,7 @@ MetaGraphT *TfliteModelParser::Parse(const std::string &modelFile, const std::st
return
nullptr
;
}
SetGraphTensorIndex
(
tensorCache
,
subGraph
.
get
());
SetGraphTensorIndex
(
t
flite_subgraph
,
tflite_model
,
t
ensorCache
,
subGraph
.
get
());
SetAllTensors
(
tensorCache
,
subGraph
.
get
());
return
subGraph
.
release
();
}
...
...
mindspore/lite/tools/converter/parser/tflite/tflite_model_parser.h
浏览文件 @
49fd9fa9
...
...
@@ -50,7 +50,10 @@ class TfliteModelParser : public ModelParser {
void
SetInputTensor
(
const
std
::
unique_ptr
<
tflite
::
SubGraphT
>
&
tflite_subgraph
,
TensorCache
*
tensor_cache
);
void
SetGraphTensorIndex
(
const
mindspore
::
lite
::
TensorCache
&
tensorCache
,
schema
::
MetaGraphT
*
subGraphDef
);
void
SetGraphTensorIndex
(
const
std
::
unique_ptr
<
tflite
::
SubGraphT
>
&
tflite_subgraph
,
const
std
::
unique_ptr
<
tflite
::
ModelT
>
&
tflite_model
,
const
mindspore
::
lite
::
TensorCache
&
tensorCache
,
schema
::
MetaGraphT
*
subGraphDef
);
STATUS
ParseOp
(
const
std
::
unique_ptr
<
tflite
::
ModelT
>
&
tflite_model
,
const
std
::
unique_ptr
<
tflite
::
SubGraphT
>
&
tflite_subgraph
,
schema
::
MetaGraphT
*
sub_graph
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录