Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle-Lite
提交
2b90556b
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看板
提交
2b90556b
编写于
9月 08, 2018
作者:
Z
zhangyang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Modify FPGA kernels to comply to Gtype
上级
ff7fc7a3
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
19 addition
and
11 deletion
+19
-11
CMakeLists.txt
CMakeLists.txt
+12
-5
src/operators/feed_op.h
src/operators/feed_op.h
+2
-1
src/operators/kernel/fpga/elementwise_add_relu_kernel.cpp
src/operators/kernel/fpga/elementwise_add_relu_kernel.cpp
+2
-2
src/operators/kernel/fpga/fc_relu_kernel.cpp
src/operators/kernel/fpga/fc_relu_kernel.cpp
+1
-1
src/operators/kernel/fpga/fusion_fc_kernel.cpp
src/operators/kernel/fpga/fusion_fc_kernel.cpp
+1
-1
src/operators/op_param.h
src/operators/op_param.h
+1
-1
未找到文件。
CMakeLists.txt
浏览文件 @
2b90556b
cmake_minimum_required
(
VERSION 3.6
)
option
(
USE_OPENMP
"openmp support"
O
N
)
option
(
USE_OPENMP
"openmp support"
O
FF
)
project
(
paddle-mobile
)
option
(
DEBUGING
"enable debug mode"
O
FF
)
option
(
DEBUGING
"enable debug mode"
O
N
)
option
(
USE_EXCEPTION
"use std exception"
OFF
)
option
(
LOG_PROFILE
"log profile"
OFF
)
# select the platform to build
option
(
CPU
"armv7 with neon"
O
N
)
option
(
CPU
"armv7 with neon"
O
FF
)
option
(
MALI_GPU
"mali gpu"
OFF
)
option
(
FPGA
"fpga"
O
FF
)
option
(
FPGA
"fpga"
O
N
)
file
(
GLOB_RECURSE PADDLE_MOBILE_CC src/*.cc src/*.cpp src/*.c src/*.mm
)
file
(
GLOB_RECURSE PADDLE_MOBILE_H src/*.h
)
...
...
@@ -94,6 +94,8 @@ else()
endif
()
if
(
FPGA
)
set
(
DEBUGING ON
)
add_definitions
(
-DPADDLE_MOBILE_DEBUG
)
add_definitions
(
-DPADDLE_MOBILE_FPGA
)
else
()
file
(
GLOB_RECURSE _tmp_list src/operators/kernel/fpga/*.cpp src/operators/kernel/fpga/*.cc
)
...
...
@@ -140,7 +142,12 @@ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY build)
set
(
CMAKE_RUNTIME_OUTPUT_DIRECTORY build
)
# NET default
set
(
NET
"default"
CACHE STRING
"select net type"
)
if
(
FPGA
)
set
(
NET
"FPGAnets"
CACHE STRING
"select net type"
)
else
()
set
(
NET
"default"
CACHE STRING
"select net type"
)
endif
()
set_property
(
CACHE NET PROPERTY STRINGS
"default"
"googlenet"
"mobilenet"
"yolo"
"squeezenet"
"FPGAnets"
"NLP"
)
include
(
"
${
CMAKE_CURRENT_LIST_DIR
}
/tools/op.cmake"
)
...
...
src/operators/feed_op.h
浏览文件 @
2b90556b
...
...
@@ -35,6 +35,7 @@ class FeedOp : public framework::OperatorBase<DeviceType> {
auto
out_dims
=
param_
.
Out
()
->
dims
();
out_dims
[
0
]
=
param_
.
BatchSize
();
param_
.
Out
()
->
Resize
(
out_dims
);
DLOG
<<
"feed_op output dims size"
<<
out_dims
.
size
();
// note : mobile infershape iscalled when executer is created. so do not
// pass lod here .
...
...
@@ -49,7 +50,7 @@ class FeedOp : public framework::OperatorBase<DeviceType> {
}
void
RunImpl
()
const
{
Tensor
*
input
=
const_cast
<
Tensor
*>
(
param_
.
InputX
());
auto
input
=
(
Tensor
*
)
const_cast
<
LoD
Tensor
*>
(
param_
.
InputX
());
auto
input_ptr
=
input
->
data
<
float
>
();
fpga
::
format_image
(
input
);
Tensor
*
output
=
param_
.
Out
();
...
...
src/operators/kernel/fpga/elementwise_add_relu_kernel.cpp
浏览文件 @
2b90556b
...
...
@@ -22,8 +22,8 @@ template <>
bool
ElementwiseAddReluKernel
<
FPGA
,
float
>::
Init
(
ElementwiseAddReluParam
<
FPGA
>
*
param
)
{
bool
relu_enabled
=
true
;
auto
*
input_x
=
const_cast
<
Tensor
*>
(
param
->
InputX
());
auto
*
input_y
=
const_cast
<
Tensor
*>
(
param
->
InputY
());
auto
*
input_x
=
const_cast
<
LoD
Tensor
*>
(
param
->
InputX
());
auto
*
input_y
=
const_cast
<
LoD
Tensor
*>
(
param
->
InputY
());
auto
*
out
=
param
->
Out
();
auto
input_x_ptr
=
input_x
->
data
<
float
>
();
auto
input_y_ptr
=
input_y
->
data
<
float
>
();
...
...
src/operators/kernel/fpga/fc_relu_kernel.cpp
浏览文件 @
2b90556b
...
...
@@ -20,7 +20,7 @@ namespace operators {
template
<
>
bool
FusionFcReluKernel
<
FPGA
,
float
>::
Init
(
FusionFcReluParam
<
FPGA
>
*
param
)
{
bool
relu_enabled
=
true
;
auto
*
input_x
=
const_cast
<
Tensor
*>
(
param
->
InputX
());
auto
*
input_x
=
const_cast
<
LoD
Tensor
*>
(
param
->
InputX
());
auto
input_x_ptr
=
input_x
->
data
<
float
>
();
auto
*
filter
=
const_cast
<
Tensor
*>
(
param
->
InputY
());
const
Tensor
*
input_z
=
param
->
InputZ
();
...
...
src/operators/kernel/fpga/fusion_fc_kernel.cpp
浏览文件 @
2b90556b
...
...
@@ -21,7 +21,7 @@ namespace operators {
template
<
>
bool
FusionFcKernel
<
FPGA
,
float
>::
Init
(
FusionFcParam
<
FPGA
>
*
param
)
{
bool
relu_enabled
=
false
;
auto
*
input_x
=
const_cast
<
Tensor
*>
(
param
->
InputX
());
auto
*
input_x
=
const_cast
<
LoD
Tensor
*>
(
param
->
InputX
());
auto
input_x_ptr
=
input_x
->
data
<
float
>
();
auto
*
filter
=
const_cast
<
Tensor
*>
(
param
->
InputY
());
const
Tensor
*
input_z
=
param
->
InputZ
();
...
...
src/operators/op_param.h
浏览文件 @
2b90556b
...
...
@@ -56,7 +56,7 @@ struct DtypeTensorTrait<CPU> {
template
<
>
struct
DtypeTensorTrait
<
FPGA
>
{
// This is the type we obtained in variable.
typedef
framework
::
Tensor
gtype
;
typedef
framework
::
LoD
Tensor
gtype
;
// This type will be the parent class type
// or the same type.
typedef
framework
::
Tensor
rtype
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录