Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle-Lite
提交
ee18a02f
P
Paddle-Lite
项目概览
PaddlePaddle
/
Paddle-Lite
通知
332
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看板
提交
ee18a02f
编写于
9月 29, 2018
作者:
X
xiebaiyuan
提交者:
GitHub
9月 29, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1026 from xiebaiyuan/develop
add rasberry supported
#910
上级
3e1be125
a2af3b5b
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
260 addition
and
81 deletion
+260
-81
CMakeLists.txt
CMakeLists.txt
+1
-1
src/jni/PML.java
src/jni/PML.java
+8
-0
src/jni/paddle_mobile_jni.cpp
src/jni/paddle_mobile_jni.cpp
+22
-0
test/CMakeLists.txt
test/CMakeLists.txt
+122
-67
test/net/test_nlp.cpp
test/net/test_nlp.cpp
+28
-2
tools/build.sh
tools/build.sh
+44
-1
tools/op.cmake
tools/op.cmake
+24
-10
tools/toolchains/arm-linux-gnueabihf.cmake
tools/toolchains/arm-linux-gnueabihf.cmake
+11
-0
未找到文件。
CMakeLists.txt
浏览文件 @
ee18a02f
cmake_minimum_required
(
VERSION 3.
6
)
cmake_minimum_required
(
VERSION 3.
0
)
option
(
USE_OPENMP
"openmp support"
OFF
)
project
(
paddle-mobile
)
...
...
src/jni/PML.java
浏览文件 @
ee18a02f
...
...
@@ -9,6 +9,14 @@ public class PML {
*/
public
static
native
boolean
load
(
String
modelDir
);
/**
* load seperated model
*
* @param modelDir model dir
* @return isloadsuccess
*/
public
static
native
boolean
loadnlp
(
String
modelDir
);
/**
* load combined model
*
...
...
src/jni/paddle_mobile_jni.cpp
浏览文件 @
ee18a02f
...
...
@@ -74,6 +74,28 @@ JNIEXPORT jboolean JNICALL Java_com_baidu_paddle_PML_load(JNIEnv *env,
return
static_cast
<
jboolean
>
(
isLoadOk
);
}
JNIEXPORT
jboolean
JNICALL
Java_com_baidu_paddle_PML_loadnlp
(
JNIEnv
*
env
,
jclass
thiz
,
jstring
modelPath
)
{
std
::
lock_guard
<
std
::
mutex
>
lock
(
shared_mutex
);
ANDROIDLOGI
(
"load invoked"
);
bool
optimize
=
true
;
bool
isLoadOk
=
false
;
#ifdef ENABLE_EXCEPTION
try
{
isLoadOk
=
getPaddleMobileInstance
()
->
Load
(
jstring2cppstring
(
env
,
modelPath
),
optimize
,
false
,
1
,
true
);
}
catch
(
paddle_mobile
::
PaddleMobileException
&
e
)
{
ANDROIDLOGE
(
"jni got an PaddleMobileException! "
,
e
.
what
());
isLoadOk
=
false
;
}
#else
isLoadOk
=
getPaddleMobileInstance
()
->
Load
(
jstring2cppstring
(
env
,
modelPath
),
optimize
,
false
,
1
,
true
);
#endif
return
static_cast
<
jboolean
>
(
isLoadOk
);
}
JNIEXPORT
jboolean
JNICALL
Java_com_baidu_paddle_PML_loadQualified
(
JNIEnv
*
env
,
jclass
thiz
,
jstring
modelPath
)
{
std
::
lock_guard
<
std
::
mutex
>
lock
(
shared_mutex
);
...
...
test/CMakeLists.txt
浏览文件 @
ee18a02f
set
(
dir
${
CMAKE_CURRENT_SOURCE_DIR
}
)
set
(
CMAKE_RUNTIME_OUTPUT_DIRECTORY
"
${
dir
}
/build"
)
set
(
FOUND_MATCH OFF
)
if
(
"googlenet"
IN_LIST NET
)
set
(
CON -1
)
message
(
STATUS
"nets :
${
NET
}
"
)
list
(
FIND NET
"googlenet"
CON
)
if
(
CON GREATER -1
)
# gen test
ADD_EXECUTABLE
(
test-googlenet net/test_googlenet.cpp test_helper.h
test_include.h executor_for_test.h
)
ADD_EXECUTABLE
(
test-googlenet net/test_googlenet.cpp test_helper.h test_include.h executor_for_test.h
)
target_link_libraries
(
test-googlenet paddle-mobile
)
elseif
(
"mobilenet"
IN_LIST NET
)
set
(
FOUND_MATCH ON
)
endif
()
list
(
FIND NET
"mobilenet"
CON
)
if
(
CON GREATER -1
)
# gen test
ADD_EXECUTABLE
(
test-mobilenet net/test_mobilenet.cpp test_helper.h
test_include.h executor_for_test.h
)
ADD_EXECUTABLE
(
test-mobilenet net/test_mobilenet.cpp test_helper.h test_include.h executor_for_test.h
)
target_link_libraries
(
test-mobilenet paddle-mobile
)
# gen test
ADD_EXECUTABLE
(
test-mobilenet-combine net/test_mobilenet_combine.cpp test_helper.h
test_include.h executor_for_test.h
)
ADD_EXECUTABLE
(
test-mobilenet-combine net/test_mobilenet_combine.cpp test_helper.h test_include.h executor_for_test.h
)
target_link_libraries
(
test-mobilenet-combine paddle-mobile
)
set
(
FOUND_MATCH ON
)
endif
()
elseif
(
"yolo"
IN_LIST NET
)
list
(
FIND NET
"yolo"
CON
)
if
(
CON GREATER -1
)
# gen test
ADD_EXECUTABLE
(
test-yolo net/test_yolo.cpp test_helper.h
test_include.h executor_for_test.h
)
ADD_EXECUTABLE
(
test-yolo net/test_yolo.cpp test_helper.h test_include.h executor_for_test.h
)
target_link_libraries
(
test-yolo paddle-mobile
)
# gen test
ADD_EXECUTABLE
(
test_yolo_combined net/test_yolo_combined.cpp test_helper.h
test_include.h executor_for_test.h
)
ADD_EXECUTABLE
(
test_yolo_combined net/test_yolo_combined.cpp test_helper.h test_include.h executor_for_test.h
)
target_link_libraries
(
test_yolo_combined paddle-mobile
)
elseif
(
"squeezenet"
IN_LIST NET
)
set
(
FOUND_MATCH ON
)
endif
()
list
(
FIND NET
"squeezenet"
CON
)
if
(
CON GREATER -1
)
# gen test
ADD_EXECUTABLE
(
test-squeezenet net/test_squeezenet.cpp test_helper.h
test_include.h executor_for_test.h
)
ADD_EXECUTABLE
(
test-squeezenet net/test_squeezenet.cpp test_helper.h test_include.h executor_for_test.h
)
target_link_libraries
(
test-squeezenet paddle-mobile
)
elseif
(
"resnet"
IN_LIST NET
)
set
(
FOUND_MATCH ON
)
endif
()
list
(
FIND NET
"resnet"
CON
)
if
(
CON GREATER -1
)
# gen test
ADD_EXECUTABLE
(
test-resnet net/test_resnet.cpp test_helper.h
test_include.h executor_for_test.h
)
ADD_EXECUTABLE
(
test-resnet net/test_resnet.cpp test_helper.h test_include.h executor_for_test.h
)
target_link_libraries
(
test-resnet paddle-mobile
)
elseif
(
"FPGAnets"
IN_LIST NET
)
ADD_EXECUTABLE
(
test-resnet net/test_resnet.cpp test_helper.h test_include.h executor_for_test.h
)
set
(
FOUND_MATCH ON
)
endif
()
list
(
FIND NET
"FPGAnets"
CON
)
if
(
CON GREATER -1
)
ADD_EXECUTABLE
(
test-resnet net/test_resnet.cpp test_helper.h test_include.h executor_for_test.h
)
target_link_libraries
(
test-resnet paddle-mobile
)
ADD_EXECUTABLE
(
test-resnet50 fpga/test_resnet50.cpp test_helper.h
test_include.h executor_for_test.h
)
ADD_EXECUTABLE
(
test-resnet50 fpga/test_resnet50.cpp test_helper.h test_include.h executor_for_test.h
)
target_link_libraries
(
test-resnet50 paddle-mobile
)
ADD_EXECUTABLE
(
test-fpga-EW fpga/test_fpga_EW.cpp test_helper.h
test_include.h executor_for_test.h
)
ADD_EXECUTABLE
(
test-fpga-EW fpga/test_fpga_EW.cpp test_helper.h test_include.h executor_for_test.h
)
target_link_libraries
(
test-fpga-EW paddle-mobile
)
ADD_EXECUTABLE
(
test-fpga-conv fpga/test_fpga_conv.cpp test_helper.h
test_include.h executor_for_test.h
)
ADD_EXECUTABLE
(
test-fpga-conv fpga/test_fpga_conv.cpp test_helper.h test_include.h executor_for_test.h
)
target_link_libraries
(
test-fpga-conv paddle-mobile
)
ADD_EXECUTABLE
(
test-fpga-pooling fpga/test_fpga_pooling.cpp test_helper.h
test_include.h executor_for_test.h
)
ADD_EXECUTABLE
(
test-fpga-pooling fpga/test_fpga_pooling.cpp test_helper.h test_include.h executor_for_test.h
)
target_link_libraries
(
test-fpga-pooling paddle-mobile
)
ADD_EXECUTABLE
(
test-fpga-bypass fpga/test_fpga_bypass.cpp test_helper.h
test_include.h executor_for_test.h
)
ADD_EXECUTABLE
(
test-fpga-bypass fpga/test_fpga_bypass.cpp test_helper.h test_include.h executor_for_test.h
)
target_link_libraries
(
test-fpga-bypass paddle-mobile
)
ADD_EXECUTABLE
(
test-fpga-softmax fpga/test_fpga_softmax.cpp test_helper.h
test_include.h executor_for_test.h
)
ADD_EXECUTABLE
(
test-fpga-softmax fpga/test_fpga_softmax.cpp test_helper.h test_include.h executor_for_test.h
)
target_link_libraries
(
test-fpga-softmax paddle-mobile
)
ADD_EXECUTABLE
(
test-fpga-concat fpga/test_fpga_concat.cpp test_helper.h
test_include.h executor_for_test.h
)
ADD_EXECUTABLE
(
test-fpga-concat fpga/test_fpga_concat.cpp test_helper.h test_include.h executor_for_test.h
)
target_link_libraries
(
test-fpga-concat paddle-mobile
)
ADD_EXECUTABLE
(
test-tensor-quant fpga/test_tensor_quant.cpp test_helper.h
test_include.h executor_for_test.h
)
ADD_EXECUTABLE
(
test-tensor-quant fpga/test_tensor_quant.cpp test_helper.h test_include.h executor_for_test.h
)
target_link_libraries
(
test-tensor-quant paddle-mobile
)
ADD_EXECUTABLE
(
test-fpga-concat-op fpga/test_concat_op.cpp test_helper.h
test_include.h
)
ADD_EXECUTABLE
(
test-fpga-concat-op fpga/test_concat_op.cpp test_helper.h test_include.h
)
target_link_libraries
(
test-fpga-concat-op paddle-mobile
)
ADD_EXECUTABLE
(
test-format-data fpga/test_format_data.cpp test_helper.h
test_include.h
)
ADD_EXECUTABLE
(
test-format-data fpga/test_format_data.cpp test_helper.h test_include.h
)
target_link_libraries
(
test-format-data paddle-mobile
)
elseif
(
"mobilenetssd"
IN_LIST NET
)
set
(
FOUND_MATCH ON
)
endif
()
list
(
FIND NET
"mobilenetssd"
CON
)
if
(
CON GREATER -1
)
# gen test
ADD_EXECUTABLE
(
test-mobilenetssd net/test_mobilenet+ssd.cpp test_helper.h
test_include.h executor_for_test.h
)
ADD_EXECUTABLE
(
test-mobilenetssd net/test_mobilenet+ssd.cpp test_helper.h test_include.h executor_for_test.h
)
target_link_libraries
(
test-mobilenetssd paddle-mobile
)
elseif
(
"nlp"
IN_LIST NET
)
set
(
FOUND_MATCH ON
)
endif
()
list
(
FIND NET
"nlp"
CON
)
if
(
CON GREATER -1
)
# gen test
ADD_EXECUTABLE
(
test-nlp net/test_nlp.cpp test_helper.h
test_include.h executor_for_test.h
)
ADD_EXECUTABLE
(
test-nlp net/test_nlp.cpp test_helper.h test_include.h executor_for_test.h
)
target_link_libraries
(
test-nlp paddle-mobile
)
# gen test
ADD_EXECUTABLE
(
test-gru-op
operators/test_gru_op.cpp test_helper.h
test_include.h
)
ADD_EXECUTABLE
(
test-gru-op
operators/test_gru_op.cpp test_helper.h
test_include.h
)
target_link_libraries
(
test-gru-op paddle-mobile
)
elseif
(
"mobilenetfssd"
IN_LIST NET
)
set
(
FOUND_MATCH ON
)
endif
()
list
(
FIND NET
"mobilenetfssd"
CON
)
if
(
CON GREATER -1
)
# gen test
ADD_EXECUTABLE
(
test-fssd
net/test_mobilenet_025_fssd.cpp test_helper.h
test_include.h
)
ADD_EXECUTABLE
(
test-fssd
net/test_mobilenet_025_fssd.cpp test_helper.h
test_include.h
)
target_link_libraries
(
test-fssd paddle-mobile
)
elseif
(
"genet"
IN_LIST NET
)
set
(
FOUND_MATCH ON
)
endif
()
list
(
FIND NET
"genet"
CON
)
if
(
CON GREATER -1
)
# gen test
ADD_EXECUTABLE
(
test-genet net/test_genet_combine.cpp test_helper.h
test_include.h executor_for_test.h
)
ADD_EXECUTABLE
(
test-genet net/test_genet_combine.cpp test_helper.h test_include.h executor_for_test.h
)
target_link_libraries
(
test-genet paddle-mobile
)
else
()
set
(
FOUND_MATCH ON
)
endif
()
if
(
NOT FOUND_MATCH
)
# gen test
ADD_EXECUTABLE
(
test-resnet net/test_resnet.cpp test_helper.h
test_include.h executor_for_test.h
)
ADD_EXECUTABLE
(
test-resnet net/test_resnet.cpp test_helper.h test_include.h executor_for_test.h
)
target_link_libraries
(
test-resnet paddle-mobile
)
# gen test
ADD_EXECUTABLE
(
test-squeezenet net/test_squeezenet.cpp test_helper.h
test_include.h executor_for_test.h
)
ADD_EXECUTABLE
(
test-squeezenet net/test_squeezenet.cpp test_helper.h test_include.h executor_for_test.h
)
target_link_libraries
(
test-squeezenet paddle-mobile
)
# gen test
ADD_EXECUTABLE
(
test-yolo net/test_yolo.cpp test_helper.h
test_include.h executor_for_test.h
)
ADD_EXECUTABLE
(
test-yolo net/test_yolo.cpp test_helper.h test_include.h executor_for_test.h
)
target_link_libraries
(
test-yolo paddle-mobile
)
# gen test
ADD_EXECUTABLE
(
test_yolo_combined net/test_yolo_combined.cpp test_helper.h
test_include.h executor_for_test.h
)
ADD_EXECUTABLE
(
test_yolo_combined net/test_yolo_combined.cpp test_helper.h test_include.h executor_for_test.h
)
target_link_libraries
(
test_yolo_combined paddle-mobile
)
# gen test
ADD_EXECUTABLE
(
test-googlenet net/test_googlenet.cpp test_helper.h
test_include.h executor_for_test.h
)
ADD_EXECUTABLE
(
test-googlenet net/test_googlenet.cpp test_helper.h test_include.h executor_for_test.h
)
target_link_libraries
(
test-googlenet paddle-mobile
)
# gen test
ADD_EXECUTABLE
(
test-conv-op
operators/test_cov_op.cpp test_helper.h
test_include.h executor_for_test.h
)
ADD_EXECUTABLE
(
test-conv-op
operators/test_cov_op.cpp test_helper.h
test_include.h executor_for_test.h
)
target_link_libraries
(
test-conv-op paddle-mobile
)
# gen test
ADD_EXECUTABLE
(
test-mul-op
operators/test_mul_op.cpp test_helper.h
test_include.h
)
ADD_EXECUTABLE
(
test-mul-op
operators/test_mul_op.cpp test_helper.h
test_include.h
)
target_link_libraries
(
test-mul-op paddle-mobile
)
# gen test
ADD_EXECUTABLE
(
test-elementwiseadd-op operators/test_elementwise_add_op.cpp test_helper.h
test_include.h
)
ADD_EXECUTABLE
(
test-elementwiseadd-op operators/test_elementwise_add_op.cpp test_helper.h test_include.h
)
target_link_libraries
(
test-elementwiseadd-op paddle-mobile
)
# gen test
ADD_EXECUTABLE
(
test-concat-op operators/test_concat_op.cpp test_helper.h
test_include.h
)
ADD_EXECUTABLE
(
test-concat-op operators/test_concat_op.cpp test_helper.h test_include.h
)
target_link_libraries
(
test-concat-op paddle-mobile
)
# gen test
ADD_EXECUTABLE
(
test-lrn-op
operators/test_lrn_op.cpp test_helper.h
test_include.h
)
ADD_EXECUTABLE
(
test-lrn-op
operators/test_lrn_op.cpp test_helper.h
test_include.h
)
target_link_libraries
(
test-lrn-op paddle-mobile
)
# gen test
ADD_EXECUTABLE
(
test-batchnorm-op
operators/test_batchnorm_op.cpp test_helper.h
test_include.h
)
ADD_EXECUTABLE
(
test-batchnorm-op
operators/test_batchnorm_op.cpp test_helper.h
test_include.h
)
target_link_libraries
(
test-batchnorm-op paddle-mobile
)
# gen test
ADD_EXECUTABLE
(
test-priorbox-op
operators/test_prior_box_op.cpp test_helper.h
test_include.h
)
ADD_EXECUTABLE
(
test-priorbox-op
operators/test_prior_box_op.cpp test_helper.h
test_include.h
)
target_link_libraries
(
test-priorbox-op paddle-mobile
)
# gen test
ADD_EXECUTABLE
(
test-boxcoder-op
operators/test_box_coder_op.cpp test_helper.h
test_include.h
)
ADD_EXECUTABLE
(
test-boxcoder-op
operators/test_box_coder_op.cpp test_helper.h
test_include.h
)
target_link_libraries
(
test-boxcoder-op paddle-mobile
)
# gen test
ADD_EXECUTABLE
(
test-transpose-op
operators/test_transpose_op.cpp test_helper.h
test_include.h
)
ADD_EXECUTABLE
(
test-transpose-op
operators/test_transpose_op.cpp test_helper.h
test_include.h
)
target_link_libraries
(
test-transpose-op paddle-mobile
)
# gen test
ADD_EXECUTABLE
(
test-multiclassnms-op
operators/test_multiclass_nms_op.cpp test_helper.h
test_include.h
)
ADD_EXECUTABLE
(
test-multiclassnms-op
operators/test_multiclass_nms_op.cpp test_helper.h
test_include.h
)
target_link_libraries
(
test-multiclassnms-op paddle-mobile
)
# gen test
ADD_EXECUTABLE
(
test-reshape-op
operators/test_reshape_op.cpp test_helper.h
test_include.h
)
ADD_EXECUTABLE
(
test-reshape-op
operators/test_reshape_op.cpp test_helper.h
test_include.h
)
target_link_libraries
(
test-reshape-op paddle-mobile
)
# gen test
ADD_EXECUTABLE
(
test-relu-op
operators/test_relu_op.cpp test_helper.h
test_include.h
)
ADD_EXECUTABLE
(
test-relu-op
operators/test_relu_op.cpp test_helper.h
test_include.h
)
target_link_libraries
(
test-relu-op paddle-mobile
)
# gen test
ADD_EXECUTABLE
(
test-fc-op
operators/test_fusion_fc_op.cpp test_helper.h
test_include.h
)
ADD_EXECUTABLE
(
test-fc-op
operators/test_fusion_fc_op.cpp test_helper.h
test_include.h
)
target_link_libraries
(
test-fc-op paddle-mobile
)
# gen test log
...
...
@@ -205,19 +259,19 @@ else ()
target_link_libraries
(
test-openmp paddle-mobile
)
# gen test
ADD_EXECUTABLE
(
test-mobilenetssd net/test_mobilenet+ssd.cpp test_helper.h
test_include.h executor_for_test.h
)
ADD_EXECUTABLE
(
test-mobilenetssd net/test_mobilenet+ssd.cpp test_helper.h test_include.h executor_for_test.h
)
target_link_libraries
(
test-mobilenetssd paddle-mobile
)
# gen test
ADD_EXECUTABLE
(
test-mobilenet-combine net/test_mobilenet_combine.cpp test_helper.h
test_include.h executor_for_test.h
)
# gen test
ADD_EXECUTABLE
(
test-mobilenet-combine net/test_mobilenet_combine.cpp test_helper.h test_include.h executor_for_test.h
)
target_link_libraries
(
test-mobilenet-combine paddle-mobile
)
# gen test
ADD_EXECUTABLE
(
test-genet net/test_genet_combine.cpp test_helper.h
test_include.h executor_for_test.h
)
ADD_EXECUTABLE
(
test-genet net/test_genet_combine.cpp test_helper.h test_include.h executor_for_test.h
)
target_link_libraries
(
test-genet paddle-mobile
)
# gen test
ADD_EXECUTABLE
(
test-sigmoid operators/test_sigmoid_op.cpp
test_include.h
)
ADD_EXECUTABLE
(
test-sigmoid operators/test_sigmoid_op.cpp test_include.h
)
target_link_libraries
(
test-sigmoid paddle-mobile
)
# gen test
...
...
@@ -225,42 +279,43 @@ else ()
target_link_libraries
(
test-depthwise-conv-op paddle-mobile
)
# gen test
ADD_EXECUTABLE
(
test-mobilenet net/test_mobilenet.cpp test_helper.h
test_include.h executor_for_test.h
)
ADD_EXECUTABLE
(
test-mobilenet net/test_mobilenet.cpp test_helper.h test_include.h executor_for_test.h
)
target_link_libraries
(
test-mobilenet paddle-mobile
)
# gen test
ADD_EXECUTABLE
(
test-conv-add-relu-op operators/test_conv_add_relu_op.cpp test_helper.h
test_include.h executor_for_test.h
)
ADD_EXECUTABLE
(
test-conv-add-relu-op operators/test_conv_add_relu_op.cpp test_helper.h test_include.h executor_for_test.h
)
target_link_libraries
(
test-conv-add-relu-op paddle-mobile
)
# gen test
ADD_EXECUTABLE
(
test-conv-add-bn-relu-op operators/test_fusion_conv_add_bn_relu_op.cpp test_helper.h
test_include.h executor_for_test.h
)
ADD_EXECUTABLE
(
test-conv-add-bn-relu-op operators/test_fusion_conv_add_bn_relu_op.cpp test_helper.h test_include.h executor_for_test.h
)
target_link_libraries
(
test-conv-add-bn-relu-op paddle-mobile
)
# gen test
ADD_EXECUTABLE
(
test-nlp net/test_nlp.cpp test_helper.h
test_include.h executor_for_test.h
)
ADD_EXECUTABLE
(
test-nlp net/test_nlp.cpp test_helper.h test_include.h executor_for_test.h
)
target_link_libraries
(
test-nlp paddle-mobile
)
# gen test
ADD_EXECUTABLE
(
test-gru-op
operators/test_gru_op.cpp test_helper.h
test_include.h
)
ADD_EXECUTABLE
(
test-gru-op
operators/test_gru_op.cpp test_helper.h
test_include.h
)
target_link_libraries
(
test-gru-op paddle-mobile
)
# gen test
ADD_EXECUTABLE
(
test-inceptionv4 net/test_inceptionv4.cpp test_helper.h
test_include.h executor_for_test.h
)
ADD_EXECUTABLE
(
test-inceptionv4 net/test_inceptionv4.cpp test_helper.h test_include.h executor_for_test.h
)
target_link_libraries
(
test-inceptionv4 paddle-mobile
)
# gen test
ADD_EXECUTABLE
(
test-alexnet net/test_alexnet.cpp test_helper.h
test_include.h executor_for_test.h
)
ADD_EXECUTABLE
(
test-alexnet net/test_alexnet.cpp test_helper.h test_include.h executor_for_test.h
)
target_link_libraries
(
test-alexnet paddle-mobile
)
ADD_EXECUTABLE
(
test-googlenetv1
net/test_googlenetv1_combine.cpp test_helper.h
test_include.h
)
ADD_EXECUTABLE
(
test-googlenetv1
net/test_googlenetv1_combine.cpp test_helper.h
test_include.h
)
target_link_libraries
(
test-googlenetv1 paddle-mobile
)
# gen test
ADD_EXECUTABLE
(
test-fssd
net/test_mobilenet_025_fssd.cpp test_helper.h
test_include.h
)
ADD_EXECUTABLE
(
test-fssd
net/test_mobilenet_025_fssd.cpp test_helper.h
test_include.h
)
target_link_libraries
(
test-fssd paddle-mobile
)
#add_library(test-lib-size SHARED common/test_lib_size.h common/test_lib_size.cpp)
endif
()
endif
()
test/net/test_nlp.cpp
浏览文件 @
ee18a02f
...
...
@@ -32,8 +32,7 @@ int main() {
std
::
cout
<<
"load cost :"
<<
time_diff
(
time1
,
time1
)
<<
"ms"
<<
std
::
endl
;
// 1064 1603 644 699 2878 1219 867 1352 8 1 13 312 479
std
::
vector
<
int64_t
>
ids
{
1064
,
1603
,
644
,
699
,
2878
,
1219
,
867
,
1352
,
8
,
1
,
13
,
312
,
479
};
std
::
vector
<
int64_t
>
ids
{
1918
,
117
,
55
,
97
,
1352
,
4272
,
1656
,
903
};
paddle_mobile
::
framework
::
LoDTensor
words
;
auto
size
=
static_cast
<
int
>
(
ids
.
size
());
...
...
@@ -56,5 +55,32 @@ int main() {
std
::
cout
<<
"predict cost :"
<<
time_diff
(
time3
,
time4
)
/
1
<<
"ms"
<<
std
::
endl
;
}
auto
time2
=
time
();
std
::
cout
<<
"load cost :"
<<
time_diff
(
time1
,
time1
)
<<
"ms"
<<
std
::
endl
;
// 1064 1603 644 699 2878 1219 867 1352 8 1 13 312 479
std
::
vector
<
int64_t
>
ids
{
1791
,
656
,
1549
,
281
,
96
};
paddle_mobile
::
framework
::
LoDTensor
words
;
auto
size
=
static_cast
<
int
>
(
ids
.
size
());
paddle_mobile
::
framework
::
LoD
lod
{{
0
,
ids
.
size
()}};
DDim
dims
{
size
,
1
};
words
.
Resize
(
dims
);
words
.
set_lod
(
lod
);
DLOG
<<
"words lod : "
<<
words
.
lod
();
auto
*
pdata
=
words
.
mutable_data
<
int64_t
>
();
size_t
n
=
words
.
numel
()
*
sizeof
(
int64_t
);
DLOG
<<
"n :"
<<
n
;
memcpy
(
pdata
,
ids
.
data
(),
n
);
DLOG
<<
"words lod 22: "
<<
words
.
lod
();
auto
time3
=
time
();
for
(
int
i
=
0
;
i
<
1
;
++
i
)
{
auto
vec_result
=
paddle_mobile
.
PredictLod
(
words
);
DLOG
<<
*
vec_result
;
}
auto
time4
=
time
();
std
::
cout
<<
"predict cost :"
<<
time_diff
(
time3
,
time4
)
/
1
<<
"ms"
<<
std
::
endl
;
return
0
;
}
tools/build.sh
浏览文件 @
ee18a02f
...
...
@@ -92,6 +92,47 @@ build_for_android() {
make
-j
8
}
build_for_arm_linux
()
{
MODE
=
"Release"
ARM_LINUX
=
"arm-linux"
if
[
"
${#
NETS
}
"
-gt
1
]
;
then
cmake ..
\
-B
"../build/release/arm-linux"
\
-DCMAKE_BUILD_TYPE
=
"
${
MODE
}
"
\
-DCMAKE_TOOLCHAIN_FILE
=
"./tools/toolchains/arm-linux-gnueabihf.cmake"
\
-DCMAKE_CXX_FLAGS
=
"-std=c++14 -mcpu=cortex-a53 -mtune=cortex-a53 -mfpu=neon-vfpv4 -mfloat-abi=hard -ftree-vectorize -funsafe-math-optimizations -pipe -mlittle-endian -munaligned-access"
\
-DNET
=
"
${
NETS
}
"
\
-D
"V7"
=
true
else
cmake ..
\
-B
"../build/release/arm-linux"
\
-DCMAKE_BUILD_TYPE
=
"
${
MODE
}
"
\
-DCMAKE_TOOLCHAIN_FILE
=
"./tools/toolchains/arm-linux-gnueabihf.cmake"
\
-DCMAKE_CXX_FLAGS
=
"-std=c++14 -mcpu=cortex-a53 -mtune=cortex-a53 -mfpu=neon-vfpv4 -mfloat-abi=hard -ftree-vectorize -funsafe-math-optimizations -pipe -mlittle-endian -munaligned-access"
\
-DNET
=
"
${
NETS
}
"
\
-D
"V7"
=
true
fi
cd
"../build/release/arm-linux"
make
-j
8
cd
"../../../test/"
DIRECTORY
=
"models"
if
[
"
`
ls
-A
$DIRECTORY
`
"
=
""
]
;
then
echo
"
$DIRECTORY
is indeed empty pull images"
wget http://mms-graph.bj.bcebos.com/paddle-mobile%2FmodelsAndImages.zip
unzip paddle-mobile%2FmodelsAndImages.zip
mv
modelsAndImages/images/ images
mv
modelsAndImages/models/ models
rm
-rf
paddle-mobile%2FmodelsAndImages.zip
rm
-rf
__MACOS
else
echo
"
$DIRECTORY
is indeed not empty, DONE!"
fi
}
build_for_ios
()
{
# rm -rf "../build"
PLATFORM
=
"ios"
...
...
@@ -135,7 +176,7 @@ if [ $# -lt 1 ]; then
echo
"sample usage: ./build.sh android"
else
params
=(
$@
)
for
((
i
=
1
;
i<
$#;
i++
))
;
do
for
((
i
=
1
;
i<
$#;
i++
))
;
do
if
[
${
i
}
!=
1
]
;
then
NETS
=
$NETS
$";"
fi
...
...
@@ -162,6 +203,8 @@ else
if
[
$1
=
"android"
]
;
then
build_for_android
elif
[
$1
=
"arm_linux"
]
;
then
build_for_arm_linux
elif
[
$1
=
"ios"
]
;
then
build_for_ios
else
...
...
tools/op.cmake
浏览文件 @
ee18a02f
set
(
FOUND_MATCH OFF
)
if
(
"googlenet"
IN_LIST NET
)
set
(
CON -1
)
message
(
STATUS
"nets :
${
NET
}
"
)
list
(
FIND NET
"googlenet"
CON
)
if
(
CON GREATER -1
)
message
(
"googlenet enabled"
)
set
(
CONCAT_OP ON
)
set
(
CONV_OP ON
)
...
...
@@ -15,7 +20,8 @@ if ("googlenet" IN_LIST NET)
set
(
FOUND_MATCH ON
)
endif
()
if
(
"mobilenet"
IN_LIST NET
)
list
(
FIND NET
"mobilenet"
CON
)
if
(
CON GREATER -1
)
message
(
"mobilenet enabled"
)
set
(
CONV_OP ON
)
set
(
ELEMENTWISEADD_OP ON
)
...
...
@@ -33,7 +39,8 @@ if ("mobilenet" IN_LIST NET)
endif
()
if
(
"mobilenetssd"
IN_LIST NET
)
list
(
FIND NET
"mobilenetssd"
CON
)
if
(
CON GREATER -1
)
message
(
"mobilenetssd enabled"
)
set
(
FUSION_CONVBNRELU_OP ON
)
set
(
FUSION_CONVBNRELU_OP ON
)
...
...
@@ -55,7 +62,8 @@ if ("mobilenetssd" IN_LIST NET)
endif
()
if
(
"yolo"
IN_LIST NET
)
list
(
FIND NET
"yolo"
CON
)
if
(
CON GREATER -1
)
message
(
"yolo enabled"
)
set
(
BATCHNORM_OP ON
)
set
(
CONV_OP ON
)
...
...
@@ -65,7 +73,8 @@ if ("yolo" IN_LIST NET)
set
(
FOUND_MATCH ON
)
endif
()
if
(
"squeezenet"
IN_LIST NET
)
list
(
FIND NET
"squeezenet"
CON
)
if
(
CON GREATER -1
)
message
(
"squeezenet enabled"
)
set
(
CONCAT_OP ON
)
set
(
CONV_OP ON
)
...
...
@@ -79,7 +88,8 @@ if ("squeezenet" IN_LIST NET)
endif
()
if
(
"resnet"
IN_LIST NET
)
list
(
FIND NET
"resnet"
CON
)
if
(
CON GREATER -1
)
message
(
"resnet enabled"
)
set
(
CONCAT_OP ON
)
set
(
CONV_OP ON
)
...
...
@@ -95,7 +105,8 @@ if ("resnet" IN_LIST NET)
set
(
FOUND_MATCH ON
)
endif
()
if
(
"FPGAnets"
IN_LIST NET
)
list
(
FIND NET
"FPGAnets"
CON
)
if
(
CON GREATER -1
)
message
(
"FPGAnets enabled"
)
set
(
FUSION_CONVADDRELU_OP ON
)
set
(
FUSION_CONVADDBNRELU_OP ON
)
...
...
@@ -114,7 +125,8 @@ if ("FPGAnets" IN_LIST NET)
set
(
FOUND_MATCH ON
)
endif
()
if
(
"nlp"
IN_LIST NET
)
list
(
FIND NET
"nlp"
CON
)
if
(
CON GREATER -1
)
message
(
"nlp enabled"
)
set
(
FUSION_FC_OP ON
)
set
(
LOOKUP_OP ON
)
...
...
@@ -127,7 +139,8 @@ if ("nlp" IN_LIST NET)
set
(
FOUND_MATCH ON
)
endif
()
if
(
"mobilenetfssd"
IN_LIST NET
)
list
(
FIND NET
"mobilenetfssd"
CON
)
if
(
CON GREATER -1
)
message
(
"mobilenetfssd enabled"
)
set
(
FUSION_CONVADDRELU_OP ON
)
set
(
FUSION_CONVADDBNRELU_OP ON
)
...
...
@@ -148,7 +161,8 @@ if ("mobilenetfssd" IN_LIST NET)
set
(
FOUND_MATCH ON
)
endif
()
if
(
"genet"
IN_LIST NET
)
list
(
FIND NET
"genet"
CON
)
if
(
CON GREATER -1
)
message
(
"genet enabled"
)
set
(
FUSION_CONVADDPRELU_OP ON
)
set
(
FUSION_CONVADDADDPRELU_OP ON
)
...
...
tools/toolchains/arm-linux-gnueabihf.cmake
0 → 100644
浏览文件 @
ee18a02f
# CMake toolchain file for building ARM software on Linux environment
set
(
CMAKE_SYSTEM_NAME Linux
)
set
(
CMAKE_SYSTEM_PROCESSOR arm
)
set
(
CMAKE_SYSTEM_VERSION 1
)
message
(
"if U build on platform . this is right."
)
set
(
CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER
)
set
(
CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY
)
set
(
CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY
)
set
(
CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY
)
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录