Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle-Lite
提交
f8d7d2be
P
Paddle-Lite
项目概览
PaddlePaddle
/
Paddle-Lite
通知
331
Star
4
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
271
列表
看板
标记
里程碑
合并请求
78
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle-Lite
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
271
Issue
271
列表
看板
标记
里程碑
合并请求
78
合并请求
78
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
f8d7d2be
编写于
9月 19, 2020
作者:
H
hong19860320
提交者:
GitHub
9月 19, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[RKNPU][APU] Fix the incorrect inference results from mobilenetv1-int8 on RKNPU and APU (#4368)
上级
f802feea
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
33 addition
and
8 deletion
+33
-8
lite/core/mir/subgraph/subgraph_detector.cc
lite/core/mir/subgraph/subgraph_detector.cc
+32
-0
lite/kernels/apu/bridges/softmax_op.cc
lite/kernels/apu/bridges/softmax_op.cc
+1
-1
lite/utils/string.h
lite/utils/string.h
+0
-7
未找到文件。
lite/core/mir/subgraph/subgraph_detector.cc
浏览文件 @
f8d7d2be
...
@@ -463,6 +463,38 @@ void SubgraphFuser::InsertNewNode(SSAGraph *graph,
...
@@ -463,6 +463,38 @@ void SubgraphFuser::InsertNewNode(SSAGraph *graph,
idata_var_names
);
idata_var_names
);
subgraph_op_desc
.
SetAttr
<
std
::
vector
<
std
::
string
>>
(
"output_data_names"
,
subgraph_op_desc
.
SetAttr
<
std
::
vector
<
std
::
string
>>
(
"output_data_names"
,
odata_var_names
);
odata_var_names
);
// Set input/output scale values of input/output var nodes for
// type_precision_cast_pass.
std
::
vector
<
float
>
input_data_scales
;
std
::
vector
<
float
>
output_data_scales
;
for
(
auto
&
var_node
:
idata_var_nodes
)
{
auto
any_op_node
=
var_node
->
outlinks
.
front
();
CHECK
(
any_op_node
->
IsStmt
());
auto
&
any_inst
=
any_op_node
->
AsStmt
();
if
(
any_inst
.
op_info
()
->
HasAttr
(
"input_scale"
))
{
input_data_scales
.
push_back
(
any_inst
.
op_info
()
->
GetAttr
<
float
>
(
"input_scale"
));
}
}
for
(
auto
&
var_node
:
odata_var_nodes
)
{
auto
any_op_node
=
var_node
->
inlinks
.
front
();
CHECK
(
any_op_node
->
IsStmt
());
auto
&
any_inst
=
any_op_node
->
AsStmt
();
if
(
any_inst
.
op_info
()
->
HasAttr
(
"output_scale"
))
{
output_data_scales
.
push_back
(
any_inst
.
op_info
()
->
GetAttr
<
float
>
(
"output_scale"
));
}
}
if
(
input_data_scales
.
size
()
>
0
)
{
subgraph_op_desc
.
SetAttr
<
std
::
vector
<
float
>>
(
"input_data_scales"
,
input_data_scales
);
}
if
(
output_data_scales
.
size
()
>
0
)
{
subgraph_op_desc
.
SetAttr
<
std
::
vector
<
float
>>
(
"output_data_scales"
,
output_data_scales
);
}
// Set all of the inputs and outputs to the target subgraph op
// Set all of the inputs and outputs to the target subgraph op
// To prevent vars are removed in RuntimeProgram::UpdateVarsOfProgram()
// To prevent vars are removed in RuntimeProgram::UpdateVarsOfProgram()
std
::
vector
<
std
::
string
>
input_var_names
;
std
::
vector
<
std
::
string
>
input_var_names
;
...
...
lite/kernels/apu/bridges/softmax_op.cc
浏览文件 @
f8d7d2be
...
@@ -104,7 +104,7 @@ int SoftmaxConverter(void* ctx, OpLite* op, KernelBase* kernel) {
...
@@ -104,7 +104,7 @@ int SoftmaxConverter(void* ctx, OpLite* op, KernelBase* kernel) {
// Add out operand
// Add out operand
NeuronOperandType
outType
;
NeuronOperandType
outType
;
outType
.
type
=
NEURON_TENSOR_QUANT8_ASYMM
;
outType
.
type
=
NEURON_TENSOR_QUANT8_ASYMM
;
outType
.
scale
=
out_scale
/
127
;
outType
.
scale
=
out_scale
;
outType
.
zeroPoint
=
128
;
outType
.
zeroPoint
=
128
;
outType
.
dimensionCount
=
x_dims
.
size
();
outType
.
dimensionCount
=
x_dims
.
size
();
outType
.
dimensions
=
&
dims_x
[
0
];
outType
.
dimensions
=
&
dims_x
[
0
];
...
...
lite/utils/string.h
浏览文件 @
f8d7d2be
...
@@ -60,13 +60,6 @@ static std::string to_string(const T& v) {
...
@@ -60,13 +60,6 @@ static std::string to_string(const T& v) {
return
ss
.
str
();
return
ss
.
str
();
}
}
static
std
::
string
to_string
(
int
index
)
{
const
int
BUFFER_LENGTH
=
15
;
char
buffer
[
BUFFER_LENGTH
];
snprintf
(
buffer
,
sizeof
(
buffer
),
"%d"
,
index
);
return
std
::
string
(
buffer
);
}
template
<
typename
T
=
std
::
string
>
template
<
typename
T
=
std
::
string
>
static
T
parse_string
(
const
std
::
string
&
v
)
{
static
T
parse_string
(
const
std
::
string
&
v
)
{
return
v
;
return
v
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录