Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle-Lite
提交
58a8d991
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看板
提交
58a8d991
编写于
7月 24, 2018
作者:
R
Ruilong Liu
提交者:
GitHub
7月 24, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #632 from chonwhite/develop
fix
#631
上级
cf1f5fe1
8dfe3997
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
91 addition
and
45 deletion
+91
-45
CMakeLists.txt
CMakeLists.txt
+2
-2
tools/build.sh
tools/build.sh
+39
-30
tools/op.cmake
tools/op.cmake
+50
-13
未找到文件。
CMakeLists.txt
浏览文件 @
58a8d991
...
...
@@ -140,8 +140,8 @@ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY build)
set
(
CMAKE_RUNTIME_OUTPUT_DIRECTORY build
)
# NET default
set
(
NET
"defult"
CACHE STRING
"select net type"
)
set_property
(
CACHE NET PROPERTY STRINGS
"defult"
"googlenet"
"mobilenet"
"yolo"
"squeezenet"
"FPGAnets"
)
set
(
NET
"def
a
ult"
CACHE STRING
"select net type"
)
set_property
(
CACHE NET PROPERTY STRINGS
"def
a
ult"
"googlenet"
"mobilenet"
"yolo"
"squeezenet"
"FPGAnets"
)
include
(
"
${
CMAKE_CURRENT_LIST_DIR
}
/tools/op.cmake"
)
...
...
tools/build.sh
浏览文件 @
58a8d991
#!/usr/bin/env bash
NETS
=
""
declare
-a
supportedNets
=(
"googlenet"
"mobilenet"
"yolo"
"squeezenet"
"resnet"
)
build_for_mac
()
{
if
[
!
`
which brew
`
]
;
then
...
...
@@ -60,7 +62,8 @@ build_for_android() {
ANDROID_PLATFORM_VERSION
=
"android-22"
TOOLCHAIN_FILE
=
"./tools/android-cmake/android.toolchain.cmake"
ANDROID_ARM_MODE
=
"arm"
if
[
$#
-eq
1
]
;
then
if
[
"
${#
NETS
}
"
>
1
]
;
then
cmake ..
\
-B
"../build/release/
${
PLATFORM
}
"
\
-DANDROID_ABI
=
"
${
ABI
}
"
\
...
...
@@ -70,7 +73,7 @@ build_for_android() {
-DCMAKE_CXX_FLAGS
=
"
${
CXX_FLAGS
}
"
\
-DANDROID_STL
=
c++_static
\
-DANDROID
=
true
\
-DNET
=
$1
\
-DNET
=
"
${
NETS
}
"
\
-D
"
${
ARM_PLATFORM
}
"
=
true
else
...
...
@@ -96,14 +99,14 @@ build_for_ios() {
BUILD_DIR
=
../build/release/
"
${
PLATFORM
}
"
/
TOOLCHAIN_FILE
=
"./tools/ios-cmake/ios.toolchain.cmake"
mkdir
-p
"
${
BUILD_DIR
}
"
if
[
$#
-eq
1
]
;
then
if
[
"
${#
NETS
}
"
>
1
]
;
then
cmake ..
\
-B
"
${
BUILD_DIR
}
"
\
-DCMAKE_BUILD_TYPE
=
"
${
MODE
}
"
\
-DIOS_PLATFORM
=
OS
\
-DIOS_ARCH
=
"
${
IOS_ARCH
}
"
\
-DCMAKE_TOOLCHAIN_FILE
=
"
${
TOOLCHAIN_FILE
}
"
\
-DNET
=
$1
\
-DNET
=
"
${
NETS
}
"
\
-DIS_IOS
=
"true"
else
cmake ..
\
...
...
@@ -123,7 +126,7 @@ build_for_ios() {
}
build_error
()
{
echo
"unknown
argument
"
echo
"unknown
target :
$1
"
}
if
[
$#
-lt
1
]
;
then
...
...
@@ -131,31 +134,37 @@ if [ $# -lt 1 ]; then
echo
"available targets: ios|android"
echo
"sample usage: ./build.sh android"
else
if
[
$#
-eq
2
]
;
then
if
[
$2
!=
"googlenet"
-a
$2
!=
"mobilenet"
-a
$2
!=
"yolo"
-a
$2
!=
"squeezenet"
-a
$2
!=
"resnet"
]
;
then
if
[
$1
=
"android"
]
;
then
build_for_android
elif
[
$1
=
"ios"
]
;
then
build_for_ios
else
build_error
fi
else
if
[
$1
=
"android"
]
;
then
build_for_android
$2
elif
[
$1
=
"ios"
]
;
then
build_for_ios
$2
else
build_error
fi
params
=(
$@
)
for
((
i
=
1
;
i<
$#;
i++
))
;
do
if
[
${
i
}
!=
1
]
;
then
NETS
=
$NETS
$";"
fi
NETS
=
$NETS
$"
${
params
[i]
}
"
done
params
=
${
@
:2
}
supported
=
false
for
name
in
${
params
[@]
}
;
do
for
net
in
${
supportedNets
[@]
}
;
do
match
=
false
if
[
"
$name
"
x
=
"
$net
"
x
]
;
then
supported
=
true
match
=
true
break
1
fi
done
if
[
"
$match
"
=
false
]
;
then
echo
"
${
name
}
not supported!"
echo
"supported nets are:
${
supportedNets
[@]
}
"
exit
-1
fi
done
if
[
$1
=
"android"
]
;
then
build_for_android
elif
[
$1
=
"ios"
]
;
then
build_for_ios
else
if
[
$1
=
"android"
]
;
then
build_for_android
elif
[
$1
=
"ios"
]
;
then
build_for_ios
else
build_error
fi
fi
build_error
"
$1
"
fi
fi
\ No newline at end of file
tools/op.cmake
浏览文件 @
58a8d991
if
(
NET STREQUAL
"googlenet"
)
set
(
FOUND_MATCH OFF
)
if
(
"googlenet"
IN_LIST NET
)
message
(
"googlenet enabled"
)
set
(
CONCAT_OP ON
)
set
(
CONV_OP ON
)
set
(
LRN_OP ON
)
...
...
@@ -9,7 +11,12 @@ if (NET STREQUAL "googlenet")
set
(
RELU_OP ON
)
set
(
FUSION_CONVADD_OP ON
)
set
(
FUSION_CONVADD_RELU_OP ON
)
elseif
(
NET STREQUAL
"mobilenet"
)
set
(
FOUND_MATCH ON
)
endif
()
if
(
"mobilenet"
IN_LIST NET
)
message
(
"mobilenet enabled"
)
set
(
CONV_OP ON
)
set
(
ELEMENTWISEADD_OP ON
)
set
(
RELU_OP ON
)
...
...
@@ -21,12 +28,23 @@ elseif (NET STREQUAL "mobilenet")
set
(
RESHAPE_OP ON
)
set
(
FUSION_CONVADDBNRELU_OP ON
)
set
(
FUSION_CONVADD_OP ON
)
elseif
(
NET STREQUAL
"yolo"
)
set
(
FOUND_MATCH ON
)
endif
()
if
(
"yolo"
IN_LIST NET
)
message
(
"yolo enabled"
)
set
(
BATCHNORM_OP ON
)
set
(
CONV_OP ON
)
set
(
RELU_OP ON
)
set
(
ELEMENTWISEADD_OP ON
)
elseif
(
NET STREQUAL
"squeezenet"
)
set
(
FOUND_MATCH ON
)
endif
()
if
(
"squeezenet"
IN_LIST NET
)
message
(
"squeezenet enabled"
)
set
(
CONCAT_OP ON
)
set
(
CONV_OP ON
)
set
(
RELU_OP ON
)
...
...
@@ -34,15 +52,26 @@ elseif (NET STREQUAL "squeezenet")
set
(
POOL_OP ON
)
set
(
RESHAPE_OP ON
)
set
(
SOFTMAX_OP ON
)
elseif
(
NET STREQUAL
"resnet"
)
set
(
FOUND_MATCH ON
)
endif
()
if
(
"resnet"
IN_LIST NET
)
message
(
"resnet enabled"
)
set
(
CONCAT_OP ON
)
set
(
CONV_OP ON
)
set
(
BATCHNORM
_OP ON
)
set
(
RELU
_OP ON
)
set
(
ELEMENTWISEADD_OP ON
)
set
(
SOFTMAX_OP ON
)
set
(
MUL_OP ON
)
set
(
POOL_OP ON
)
set
(
RELU_OP ON
)
elseif
(
NET STREQUAL
"FPGAnets"
)
set
(
RESHAPE_OP ON
)
set
(
SOFTMAX_OP ON
)
set
(
FOUND_MATCH ON
)
endif
()
if
(
"FPGAnets"
IN_LIST NET
)
message
(
"FPGAnets enabled"
)
set
(
FUSION_CONVRELU_OP ON
)
set
(
FUSION_CONVBNSCALE_OP ON
)
set
(
FUSION_CONVBNSCALERELU_OP ON
)
...
...
@@ -51,8 +80,14 @@ elseif (NET STREQUAL "FPGAnets")
set
(
REGION_OP ON
)
set
(
POOL_OP ON
)
set
(
CONCAT_OP ON
)
set
(
SOFTMAX_OP ON
)
else
()
set
(
SOFTMAX_OP ON
)
set
(
FOUND_MATCH ON
)
endif
()
if
(
NOT FOUND_MATCH
)
message
(
"--default--"
)
set
(
BATCHNORM_OP ON
)
set
(
BOXCODER_OP ON
)
set
(
CONCAT_OP ON
)
...
...
@@ -82,6 +117,8 @@ else ()
set
(
SLICE_OP ON
)
set
(
DROPOUT_OP ON
)
set
(
IM2SEQUENCE_OP ON
)
endif
()
# option(BATCHNORM_OP "" ON)
# option(BOXCODER_OP "" ON)
# option(CONCAT_OP "" ON)
...
...
@@ -102,7 +139,7 @@ else ()
# option(SOFTMAX_OP "" ON)
# option(TRANSPOSE_OP "" ON)
# option(FUSION_CONVADD_RELU_OP "" ON)
endif
()
#
endif ()
if
(
BATCHNORM_OP
)
add_definitions
(
-DBATCHNORM_OP
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录