Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
magicwindyyd
mindspore
提交
551cdfe2
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看板
提交
551cdfe2
编写于
8月 08, 2020
作者:
H
hangq
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
return unorderd_map rather than vector for LiteSession::GetOutputs
上级
fcdc9c40
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
10 addition
and
16 deletion
+10
-16
mindspore/lite/include/lite_session.h
mindspore/lite/include/lite_session.h
+3
-2
mindspore/lite/src/lite_session.cc
mindspore/lite/src/lite_session.cc
+2
-11
mindspore/lite/src/lite_session.h
mindspore/lite/src/lite_session.h
+1
-1
mindspore/lite/test/ut/src/infer_test.cc
mindspore/lite/test/ut/src/infer_test.cc
+4
-2
未找到文件。
mindspore/lite/include/lite_session.h
浏览文件 @
551cdfe2
...
...
@@ -20,6 +20,7 @@
#include <memory>
#include <vector>
#include <string>
#include <unordered_map>
#include "include/ms_tensor.h"
#include "include/model.h"
#include "include/context.h"
...
...
@@ -85,8 +86,8 @@ class MS_API LiteSession {
/// \brief Get output MindSpore Lite MSTensors of model.
///
/// \return A
vector of
MindSpore Lite MSTensor.
virtual
std
::
vector
<
tensor
::
MSTensor
*
>
GetOutputs
()
const
=
0
;
/// \return A
map of output node name and
MindSpore Lite MSTensor.
virtual
std
::
unordered_map
<
std
::
string
,
std
::
vector
<
mindspore
::
tensor
::
MSTensor
*>
>
GetOutputs
()
const
=
0
;
/// \brief Get output MindSpore Lite MSTensors of model by node name.
///
...
...
mindspore/lite/src/lite_session.cc
浏览文件 @
551cdfe2
...
...
@@ -177,17 +177,8 @@ int LiteSession::RunGraph(const session::KernelCallBack &before, const session::
}
}
std
::
vector
<
mindspore
::
tensor
::
MSTensor
*>
LiteSession
::
GetOutputs
()
const
{
std
::
vector
<
mindspore
::
tensor
::
MSTensor
*>
ret
;
for
(
auto
&
iter
:
this
->
output_map
)
{
auto
&
node_output_tensors
=
iter
.
second
;
for
(
auto
tensor
:
node_output_tensors
)
{
if
(
!
IsContain
(
ret
,
tensor
))
{
ret
.
emplace_back
(
tensor
);
}
}
}
return
ret
;
std
::
unordered_map
<
std
::
string
,
std
::
vector
<
mindspore
::
tensor
::
MSTensor
*>>
LiteSession
::
GetOutputs
()
const
{
return
this
->
output_map
;
}
int
LiteSession
::
Init
(
Context
*
context
)
{
...
...
mindspore/lite/src/lite_session.h
浏览文件 @
551cdfe2
...
...
@@ -49,7 +49,7 @@ class LiteSession : public session::LiteSession {
int
RunGraph
(
const
session
::
KernelCallBack
&
before
=
nullptr
,
const
session
::
KernelCallBack
&
after
=
nullptr
)
override
;
std
::
vector
<
mindspore
::
tensor
::
MSTensor
*
>
GetOutputs
()
const
override
;
std
::
unordered_map
<
std
::
string
,
std
::
vector
<
mindspore
::
tensor
::
MSTensor
*>
>
GetOutputs
()
const
override
;
std
::
vector
<
mindspore
::
tensor
::
MSTensor
*>
GetOutputsByName
(
const
std
::
string
&
name
)
const
override
;
...
...
mindspore/lite/test/ut/src/infer_test.cc
浏览文件 @
551cdfe2
...
...
@@ -130,7 +130,8 @@ TEST_F(InferTest, TestConvNode) {
ASSERT_EQ
(
lite
::
RET_OK
,
ret
);
auto
outputs
=
session
->
GetOutputs
();
ASSERT_EQ
(
outputs
.
size
(),
1
);
auto
outTensor
=
outputs
.
front
();
ASSERT_EQ
(
outputs
.
begin
()
->
second
.
size
(),
1
);
auto
outTensor
=
outputs
.
begin
()
->
second
.
front
();
ASSERT_NE
(
nullptr
,
outTensor
);
ASSERT_EQ
(
28
*
28
*
32
,
outTensor
->
ElementsNum
());
ASSERT_EQ
(
TypeId
::
kNumberTypeFloat32
,
outTensor
->
data_type
());
...
...
@@ -220,7 +221,8 @@ TEST_F(InferTest, TestAddNode) {
ASSERT_EQ
(
lite
::
RET_OK
,
ret
);
auto
outputs
=
session
->
GetOutputs
();
ASSERT_EQ
(
outputs
.
size
(),
1
);
auto
outTensor
=
outputs
.
front
();
ASSERT_EQ
(
outputs
.
begin
()
->
second
.
size
(),
1
);
auto
outTensor
=
outputs
.
begin
()
->
second
.
front
();
ASSERT_NE
(
nullptr
,
outTensor
);
ASSERT_EQ
(
28
*
28
*
3
,
outTensor
->
ElementsNum
());
ASSERT_EQ
(
TypeId
::
kNumberTypeFloat32
,
outTensor
->
data_type
());
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录