Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleDetection
提交
f2b88ecf
P
PaddleDetection
项目概览
PaddlePaddle
/
PaddleDetection
大约 1 年 前同步成功
通知
695
Star
11112
Fork
2696
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
184
列表
看板
标记
里程碑
合并请求
40
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleDetection
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
184
Issue
184
列表
看板
标记
里程碑
合并请求
40
合并请求
40
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
f2b88ecf
编写于
6月 25, 2019
作者:
T
tensor-tang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Tangjian/lite/int8
上级
d2de6a65
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
53 addition
and
1 deletion
+53
-1
paddle/fluid/lite/core/lite_tensor.h
paddle/fluid/lite/core/lite_tensor.h
+16
-0
paddle/fluid/lite/kernels/arm/conv_compute.cc
paddle/fluid/lite/kernels/arm/conv_compute.cc
+37
-1
未找到文件。
paddle/fluid/lite/core/lite_tensor.h
浏览文件 @
f2b88ecf
...
...
@@ -47,6 +47,22 @@ class DDimLite : public DDimBase<DDimLite> {
std
::
multiplies
<
value_type
>
());
}
const
std
::
vector
<
value_type
>
&
data
()
const
{
return
data_
;
}
value_type
count
(
int
start
,
int
end
)
{
if
(
start
<
0
)
{
start
=
0
;
}
if
(
end
>
size
())
{
end
=
size
();
}
if
(
end
<
start
)
{
end
=
start
;
}
value_type
sum
=
1
;
for
(
auto
i
=
start
;
i
<
end
;
++
i
)
{
sum
*=
data_
[
i
];
}
return
sum
;
}
private:
std
::
vector
<
value_type
>
data_
;
...
...
paddle/fluid/lite/kernels/arm/conv_compute.cc
浏览文件 @
f2b88ecf
...
...
@@ -95,8 +95,44 @@ void ConvCompute::Run() {
template
<
PrecisionType
Ptype_out
>
void
ConvComputeInt8
<
Ptype_out
>::
PrepareForRun
()
{
auto
&
param
=
this
->
Param
<
param_t
>
();
auto
x_dims
=
param
.
x
->
dims
();
auto
w_dims
=
param
.
filter
->
dims
();
auto
o_dims
=
param
.
output
->
dims
();
auto
&
ctx
=
this
->
ctx_
->
template
As
<
ARMContext
>();
impl_
=
new
lite
::
arm
::
math
::
GemmLikeConvInt8
<
Ptype_out
>
;
int
win
=
x_dims
[
3
];
// nchw
int
hin
=
x_dims
[
2
];
int
ic
=
x_dims
[
1
];
int
bs
=
x_dims
[
0
];
int
ow
=
o_dims
[
3
];
int
oh
=
o_dims
[
2
];
int
oc
=
o_dims
[
1
];
int
kh
=
w_dims
[
2
];
// oihw
int
kw
=
w_dims
[
3
];
int
ph
=
param
.
paddings
[
1
];
int
pw
=
param
.
paddings
[
0
];
int
sh
=
param
.
strides
[
1
];
int
sw
=
param
.
strides
[
0
];
bool
kps_equal
=
(
pw
==
ph
)
&&
(
sh
==
sw
)
&&
(
kw
==
kh
);
bool
no_dilation
=
(
param
.
dilations
[
0
]
==
1
)
&&
(
param
.
dilations
[
1
]
==
1
);
bool
flag_dw_3x3
=
(
kw
==
3
)
&&
(
ph
==
1
)
&&
(
sw
==
1
||
sw
==
2
);
bool
flag_dw_5x5
=
(
kw
==
5
&&
sw
==
1
&&
ph
==
2
);
bool
flag_dw
=
flag_dw_3x3
||
flag_dw_5x5
;
// weigth is int8 and bias is int32 so do not need trans
if
(
param
.
groups
==
ic
&&
ic
==
oc
&&
kps_equal
&&
no_dilation
&&
flag_dw
)
{
impl_
=
new
lite
::
arm
::
math
::
DepthwiseConvInt8
<
Ptype_out
>
;
VLOG
(
3
)
<<
"DepthwiseConv Int8"
;
}
else
if
(
param
.
groups
==
1
&&
kw
==
3
&&
(
sw
==
1
||
sw
==
2
)
&&
kps_equal
&&
no_dilation
)
{
// impl_ = new lite::arm::math::DirectConv<Ptype_out>;
}
else
{
VLOG
(
3
)
<<
"GemmLikeConvInt8"
;
impl_
=
new
lite
::
arm
::
math
::
GemmLikeConvInt8
<
Ptype_out
>
;
}
CHECK
(
this
->
impl_
->
create
(
param
,
&
ctx
));
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录