Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle-Lite
提交
af27bfff
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看板
提交
af27bfff
编写于
9月 09, 2020
作者:
Y
yongqiang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add calib kernel to support int64 to float32. test=develop
上级
6d2b2a40
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
92 addition
and
0 deletion
+92
-0
lite/kernels/arm/calib_compute.cc
lite/kernels/arm/calib_compute.cc
+79
-0
lite/kernels/arm/calib_compute.h
lite/kernels/arm/calib_compute.h
+13
-0
未找到文件。
lite/kernels/arm/calib_compute.cc
浏览文件 @
af27bfff
...
...
@@ -44,6 +44,17 @@ void CalibComputeInt64ToInt32<DLType>::Run() {
}
}
template
<
DataLayoutType
DLType
>
void
CalibComputeInt64ToFloat32
<
DLType
>::
Run
()
{
auto
&
param
=
this
->
template
Param
<
operators
::
CalibParam
>();
const
auto
*
din
=
param
.
input
->
template
data
<
int64_t
>();
std
::
vector
<
float
>
scale
=
{
param
.
scale
};
auto
*
dout
=
param
.
output
->
template
mutable_data
<
float
>();
for
(
auto
i
=
0
;
i
<
param
.
input
->
numel
();
++
i
)
{
dout
[
i
]
=
din
[
i
];
}
}
template
<
DataLayoutType
DLType
>
void
CalibComputeInt8ToFp32
<
DLType
>::
Run
()
{
auto
&
param
=
this
->
template
Param
<
operators
::
CalibParam
>();
...
...
@@ -133,6 +144,40 @@ REGISTER_LITE_KERNEL(
DATALAYOUT
(
kNCHW
))})
.
Finalize
();
REGISTER_LITE_KERNEL
(
calib
,
kARM
,
kFloat
,
kNCHW
,
paddle
::
lite
::
kernels
::
arm
::
CalibComputeInt64ToFloat32
<
DATALAYOUT
(
kNCHW
)
>
,
int64_to_float32
)
.
BindInput
(
"Input"
,
{
LiteType
::
GetTensorTy
(
TARGET
(
kAny
),
PRECISION
(
kInt64
),
DATALAYOUT
(
kNCHW
))})
.
BindOutput
(
"Out"
,
{
LiteType
::
GetTensorTy
(
TARGET
(
kARM
),
PRECISION
(
kFloat
),
DATALAYOUT
(
kNCHW
))})
.
Finalize
();
REGISTER_LITE_KERNEL
(
calib
,
kARM
,
kInt64
,
kNCHW
,
paddle
::
lite
::
kernels
::
arm
::
CalibComputeInt64ToFloat32
<
DATALAYOUT
(
kNCHW
)
>
,
int64_to_float32
)
.
BindInput
(
"Input"
,
{
LiteType
::
GetTensorTy
(
TARGET
(
kHost
),
PRECISION
(
kInt64
),
DATALAYOUT
(
kNCHW
))})
.
BindOutput
(
"Out"
,
{
LiteType
::
GetTensorTy
(
TARGET
(
kARM
),
PRECISION
(
kFloat
),
DATALAYOUT
(
kNCHW
))})
.
Finalize
();
REGISTER_LITE_KERNEL
(
calib_once
,
kARM
,
...
...
@@ -206,3 +251,37 @@ REGISTER_LITE_KERNEL(
PRECISION
(
kInt32
),
DATALAYOUT
(
kNCHW
))})
.
Finalize
();
REGISTER_LITE_KERNEL
(
calib_once
,
kARM
,
kFloat
,
kNCHW
,
paddle
::
lite
::
kernels
::
arm
::
CalibComputeInt64ToFloat32
<
DATALAYOUT
(
kNCHW
)
>
,
int64_to_float32
)
.
BindInput
(
"Input"
,
{
LiteType
::
GetTensorTy
(
TARGET
(
kARM
),
PRECISION
(
kInt64
),
DATALAYOUT
(
kNCHW
))})
.
BindOutput
(
"Out"
,
{
LiteType
::
GetTensorTy
(
TARGET
(
kARM
),
PRECISION
(
kFloat
),
DATALAYOUT
(
kNCHW
))})
.
Finalize
();
REGISTER_LITE_KERNEL
(
calib_once
,
kARM
,
kInt64
,
kNCHW
,
paddle
::
lite
::
kernels
::
arm
::
CalibComputeInt64ToFloat32
<
DATALAYOUT
(
kNCHW
)
>
,
int64_to_float32
)
.
BindInput
(
"Input"
,
{
LiteType
::
GetTensorTy
(
TARGET
(
kHost
),
PRECISION
(
kInt64
),
DATALAYOUT
(
kNCHW
))})
.
BindOutput
(
"Out"
,
{
LiteType
::
GetTensorTy
(
TARGET
(
kARM
),
PRECISION
(
kFloat
),
DATALAYOUT
(
kNCHW
))})
.
Finalize
();
lite/kernels/arm/calib_compute.h
浏览文件 @
af27bfff
...
...
@@ -47,6 +47,19 @@ class CalibComputeInt64ToInt32
private:
};
template
<
DataLayoutType
DLType
>
class
CalibComputeInt64ToFloat32
:
public
KernelLite
<
TARGET
(
kARM
),
PRECISION
(
kInt64
),
DLType
>
{
public:
using
param_t
=
operators
::
CalibParam
;
void
Run
()
override
;
~
CalibComputeInt64ToFloat32
()
override
{};
private:
};
template
<
DataLayoutType
DLType
>
class
CalibComputeInt8ToFp32
:
public
KernelLite
<
TARGET
(
kARM
),
PRECISION
(
kInt8
),
DLType
>
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录