Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
4adb6195
P
Paddle
项目概览
PaddlePaddle
/
Paddle
大约 1 年 前同步成功
通知
2298
Star
20931
Fork
5422
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1423
列表
看板
标记
里程碑
合并请求
543
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1,423
Issue
1,423
列表
看板
标记
里程碑
合并请求
543
合并请求
543
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
4adb6195
编写于
5月 24, 2019
作者:
Y
Yan Chunwei
提交者:
GitHub
5月 24, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
lite/init test trigger (#17627)
上级
47060a9e
变更
12
隐藏空白更改
内联
并排
Showing
12 changed file
with
170 addition
and
44 deletion
+170
-44
paddle/fluid/lite/CMakeLists.txt
paddle/fluid/lite/CMakeLists.txt
+30
-4
paddle/fluid/lite/api/CMakeLists.txt
paddle/fluid/lite/api/CMakeLists.txt
+13
-13
paddle/fluid/lite/api/cxx_api_test.cc
paddle/fluid/lite/api/cxx_api_test.cc
+0
-3
paddle/fluid/lite/api/light_api_test.cc
paddle/fluid/lite/api/light_api_test.cc
+0
-5
paddle/fluid/lite/core/CMakeLists.txt
paddle/fluid/lite/core/CMakeLists.txt
+9
-6
paddle/fluid/lite/core/memory.cc
paddle/fluid/lite/core/memory.cc
+1
-1
paddle/fluid/lite/model_parser/CMakeLists.txt
paddle/fluid/lite/model_parser/CMakeLists.txt
+1
-1
paddle/fluid/lite/operators/CMakeLists.txt
paddle/fluid/lite/operators/CMakeLists.txt
+2
-3
paddle/fluid/lite/operators/fc_op_test.cc
paddle/fluid/lite/operators/fc_op_test.cc
+1
-5
paddle/fluid/lite/tools/build.sh
paddle/fluid/lite/tools/build.sh
+110
-0
paddle/fluid/lite/utils/CMakeLists.txt
paddle/fluid/lite/utils/CMakeLists.txt
+0
-1
paddle/fluid/lite/utils/varient.h
paddle/fluid/lite/utils/varient.h
+3
-2
未找到文件。
paddle/fluid/lite/CMakeLists.txt
浏览文件 @
4adb6195
...
@@ -60,7 +60,7 @@ endfunction()
...
@@ -60,7 +60,7 @@ endfunction()
function
(
lite_cc_library TARGET
)
function
(
lite_cc_library TARGET
)
set
(
options
""
)
set
(
options
""
)
set
(
oneValueArgs
""
)
set
(
oneValueArgs
""
)
set
(
multiValueArgs SRCS DEPS X86_DEPS CUDA_DEPS ARM_DEPS
)
set
(
multiValueArgs SRCS DEPS X86_DEPS CUDA_DEPS ARM_DEPS
ARGS
)
cmake_parse_arguments
(
args
"
${
options
}
"
"
${
oneValueArgs
}
"
"
${
multiValueArgs
}
"
${
ARGN
}
)
cmake_parse_arguments
(
args
"
${
options
}
"
"
${
oneValueArgs
}
"
"
${
multiValueArgs
}
"
${
ARGN
}
)
set
(
deps
""
)
set
(
deps
""
)
...
@@ -71,13 +71,38 @@ function(lite_cc_library TARGET)
...
@@ -71,13 +71,38 @@ function(lite_cc_library TARGET)
ARM_DEPS
${
args_ARM_DEPS
}
ARM_DEPS
${
args_ARM_DEPS
}
)
)
cc_library
(
${
TARGET
}
SRCS
${
args_SRCS
}
DEPS
${
deps
}
)
cc_library
(
${
TARGET
}
SRCS
${
args_SRCS
}
DEPS
${
deps
}
${
args_DEPS
}
)
endfunction
()
endfunction
()
function
(
lite_cc_binary TARGET
)
set
(
options
""
)
set
(
oneValueArgs
""
)
set
(
multiValueArgs SRCS DEPS X86_DEPS CUDA_DEPS ARM_DEPS ARGS
)
cmake_parse_arguments
(
args
"
${
options
}
"
"
${
oneValueArgs
}
"
"
${
multiValueArgs
}
"
${
ARGN
}
)
set
(
deps
""
)
lite_deps
(
deps
DEPS
${
args_DEPS
}
X86_DEPS
${
args_X86_DEPS
}
CUDA_DEPS
${
args_CUDA_DEPS
}
ARM_DEPS
${
args_ARM_DEPS
}
)
cc_binary
(
${
TARGET
}
SRCS
${
args_SRCS
}
DEPS
${
deps
}
${
args_DEPS
}
)
endfunction
()
# Add a unit-test name to file for latter offline manual test.
set
(
offline_test_registry_file
"
${
CMAKE_BINARY_DIR
}
/lite_tests.txt"
)
file
(
WRITE
${
offline_test_registry_file
}
""
)
# clean
function
(
register_test_offline TARGET
)
file
(
APPEND
${
offline_test_registry_file
}
"
${
TARGET
}
\n
"
)
endfunction
()
# Test lite modules.
function
(
lite_cc_test TARGET
)
function
(
lite_cc_test TARGET
)
set
(
options
""
)
set
(
options
""
)
set
(
oneValueArgs
""
)
set
(
oneValueArgs
""
)
set
(
multiValueArgs SRCS DEPS X86_DEPS CUDA_DEPS ARM_DEPS
)
set
(
multiValueArgs SRCS DEPS X86_DEPS CUDA_DEPS ARM_DEPS
ARGS
)
cmake_parse_arguments
(
args
"
${
options
}
"
"
${
oneValueArgs
}
"
"
${
multiValueArgs
}
"
${
ARGN
}
)
cmake_parse_arguments
(
args
"
${
options
}
"
"
${
oneValueArgs
}
"
"
${
multiValueArgs
}
"
${
ARGN
}
)
set
(
deps
""
)
set
(
deps
""
)
...
@@ -87,7 +112,8 @@ function(lite_cc_test TARGET)
...
@@ -87,7 +112,8 @@ function(lite_cc_test TARGET)
CUDA_DEPS
${
args_CUDA_DEPS
}
CUDA_DEPS
${
args_CUDA_DEPS
}
ARM_DEPS
${
args_ARM_DEPS
}
ARM_DEPS
${
args_ARM_DEPS
}
)
)
_lite_cc_test
(
${
TARGET
}
SRCS
${
args_SRCS
}
DEPS
${
deps
}
)
_lite_cc_test
(
${
TARGET
}
SRCS
${
args_SRCS
}
DEPS
${
deps
}
ARGS
${
args_ARGS
}
)
register_test_offline
(
"
${
TARGET
}
"
)
endfunction
()
endfunction
()
add_subdirectory
(
core
)
add_subdirectory
(
core
)
...
...
paddle/fluid/lite/api/CMakeLists.txt
浏览文件 @
4adb6195
...
@@ -25,22 +25,22 @@ set(LITE_DEMO_INSTALL_DIR "${THIRD_PARTY_PATH}/inference_demo" CACHE STRING
...
@@ -25,22 +25,22 @@ set(LITE_DEMO_INSTALL_DIR "${THIRD_PARTY_PATH}/inference_demo" CACHE STRING
"A path setting inference demo download directories."
)
"A path setting inference demo download directories."
)
lite_cc_test
(
test_cxx_api_lite SRCS cxx_api_test.cc
#
lite_cc_test(test_cxx_api_lite SRCS cxx_api_test.cc
DEPS cxx_api_lite model_parser_lite target_wrapper_host
#
DEPS cxx_api_lite model_parser_lite target_wrapper_host
${
ops_lite
}
${
host_kernels
}
ARGS --model_dir=
${
LITE_MODEL_DIR
}
/lite_naive_model
#
${ops_lite} ${host_kernels} ARGS --model_dir=${LITE_MODEL_DIR}/lite_naive_model
--optimized_model=
${
LITE_MODEL_DIR
}
/lite_naive_model_opt SERIAL
)
#
--optimized_model=${LITE_MODEL_DIR}/lite_naive_model_opt SERIAL)
if
(
WITH_TESTING
)
if
(
WITH_TESTING
)
lite_download_and_uncompress
(
${
LITE_MODEL_DIR
}
${
LITE_URL
}
"lite_naive_model.tar.gz"
)
lite_download_and_uncompress
(
${
LITE_MODEL_DIR
}
${
LITE_URL
}
"lite_naive_model.tar.gz"
)
add_dependencies
(
test_cxx_api_lite extern_lite_download_lite_naive_model_tar_gz
)
#
add_dependencies(test_cxx_api_lite extern_lite_download_lite_naive_model_tar_gz)
endif
(
WITH_TESTING
)
endif
(
WITH_TESTING
)
lite_cc_test
(
test_light_api SRCS light_api_test.cc DEPS light_api_lite ARGS --optimized_model=
${
LITE_MODEL_DIR
}
/lite_naive_model_opt SERIAL
)
#
lite_cc_test(test_light_api SRCS light_api_test.cc DEPS light_api_lite ARGS --optimized_model=${LITE_MODEL_DIR}/lite_naive_model_opt SERIAL)
cc_binary
(
cxx_api_lite_bin SRCS cxx_api_bin.cc
lite_
cc_binary
(
cxx_api_lite_bin SRCS cxx_api_bin.cc
DEPS
DEPS
cxx_api_lite
cxx_api_lite
model_parser_lite
model_parser_lite
target_wrapper_host
target_wrapper_host
mir_passes
mir_passes
${
ops_lite
}
${
host_kernels
}
${
arm_kernels
}
)
${
ops_lite
}
${
host_kernels
}
ARM_DEPS
${
arm_kernels
}
)
paddle/fluid/lite/api/cxx_api_test.cc
浏览文件 @
4adb6195
...
@@ -120,9 +120,6 @@ USE_LITE_OP(scale);
...
@@ -120,9 +120,6 @@ USE_LITE_OP(scale);
USE_LITE_OP
(
feed
);
USE_LITE_OP
(
feed
);
USE_LITE_OP
(
fetch
);
USE_LITE_OP
(
fetch
);
USE_LITE_OP
(
io_copy
);
USE_LITE_OP
(
io_copy
);
USE_LITE_KERNEL
(
fc
,
kHost
,
kFloat
,
kNCHW
,
def
);
USE_LITE_KERNEL
(
mul
,
kHost
,
kFloat
,
kNCHW
,
def
);
USE_LITE_KERNEL
(
scale
,
kHost
,
kFloat
,
kNCHW
,
def
);
USE_LITE_KERNEL
(
feed
,
kHost
,
kAny
,
kAny
,
def
);
USE_LITE_KERNEL
(
feed
,
kHost
,
kAny
,
kAny
,
def
);
USE_LITE_KERNEL
(
fetch
,
kHost
,
kAny
,
kAny
,
def
);
USE_LITE_KERNEL
(
fetch
,
kHost
,
kAny
,
kAny
,
def
);
...
...
paddle/fluid/lite/api/light_api_test.cc
浏览文件 @
4adb6195
...
@@ -44,8 +44,3 @@ USE_LITE_OP(scale);
...
@@ -44,8 +44,3 @@ USE_LITE_OP(scale);
USE_LITE_OP
(
feed
);
USE_LITE_OP
(
feed
);
USE_LITE_OP
(
fetch
);
USE_LITE_OP
(
fetch
);
USE_LITE_OP
(
io_copy
);
USE_LITE_OP
(
io_copy
);
USE_LITE_KERNEL
(
fc
,
kHost
,
kFloat
,
kNCHW
,
def
);
USE_LITE_KERNEL
(
mul
,
kHost
,
kFloat
,
kNCHW
,
def
);
USE_LITE_KERNEL
(
scale
,
kHost
,
kFloat
,
kNCHW
,
def
);
USE_LITE_KERNEL
(
feed
,
kHost
,
kAny
,
kAny
,
def
);
USE_LITE_KERNEL
(
fetch
,
kHost
,
kAny
,
kAny
,
def
);
paddle/fluid/lite/core/CMakeLists.txt
浏览文件 @
4adb6195
if
(
WITH_TESTING
)
if
(
WITH_TESTING
)
cc_library
(
lite_gtest_main SRCS lite_gtest_main.cc DEPS gtest
)
cc_library
(
lite_gtest_main SRCS lite_gtest_main.cc DEPS gtest
)
endif
()
endif
()
cc_library
(
memory_lite SRCS memory.cc DEPS target_wrapper_lite
)
lite_cc_library
(
target_wrapper_lite SRCS target_wrapper.cc
lite_cc_library
(
target_wrapper_lite SRCS target_wrapper.cc DEPS target_wrapper_host X86_DEPS target_wrapper_x86 CUDA_DEPS target_wrapper_cuda
)
DEPS target_wrapper_host
cc_library
(
lite_tensor SRCS lite_tensor.cc DEPS memory_lite target_wrapper_lite
)
X86_DEPS target_wrapper_x86
CUDA_DEPS target_wrapper_cuda
)
lite_cc_library
(
memory_lite SRCS memory.cc DEPS target_wrapper_lite
)
lite_cc_library
(
lite_tensor SRCS lite_tensor.cc DEPS memory_lite target_wrapper_lite
)
if
(
NOT LITE_WITH_LIGHT_WEIGHT_FRAMEWORK
)
if
(
NOT LITE_WITH_LIGHT_WEIGHT_FRAMEWORK
)
cc_library
(
hvy_tensor SRCS hvy_tensor.cc DEPS lod_tensor
)
cc_library
(
hvy_tensor SRCS hvy_tensor.cc DEPS lod_tensor
)
endif
()
endif
()
...
@@ -16,12 +19,12 @@ endif()
...
@@ -16,12 +19,12 @@ endif()
proto_library
(
framework_proto_lite SRCS framework.proto
)
proto_library
(
framework_proto_lite SRCS framework.proto
)
cc_library
(
kernel_lite SRCS kernel.cc DEPS type_system target_wrapper_lite
)
cc_library
(
kernel_lite SRCS kernel.cc DEPS type_system target_wrapper_lite
any_lite
)
cc_library
(
variable_lite SRCS variable.cc
)
cc_library
(
variable_lite SRCS variable.cc
)
cc_library
(
op_registry_lite SRCS op_registry.cc DEPS framework_proto_lite
)
cc_library
(
op_registry_lite SRCS op_registry.cc DEPS framework_proto_lite
)
cc_library
(
scope_lite SRCS scope.cc
)
cc_library
(
scope_lite SRCS scope.cc
)
cc_library
(
context_lite SRCS context.cc DEPS any_lite
)
cc_library
(
context_lite SRCS context.cc DEPS any_lite
)
cc_library
(
op_lite SRCS op_lite.cc DEPS scope_lite op_registry_lite compatible_pb_lite
)
cc_library
(
op_lite SRCS op_lite.cc DEPS scope_lite op_registry_lite compatible_pb_lite
target_wrapper_lite
${
tensor_lite
}
)
cc_library
(
types_lite SRCS types.cc
)
cc_library
(
types_lite SRCS types.cc
)
cc_library
(
type_system SRCS type_system.cc DEPS
${
tensor_lite
}
target_wrapper_lite
)
cc_library
(
type_system SRCS type_system.cc DEPS
${
tensor_lite
}
target_wrapper_lite
)
...
@@ -42,7 +45,7 @@ cc_library(program_fake_utils SRCS program_fake_utils.cc DEPS mir_ssa_graph
...
@@ -42,7 +45,7 @@ cc_library(program_fake_utils SRCS program_fake_utils.cc DEPS mir_ssa_graph
)
)
lite_cc_test
(
test_scope_lite SRCS scope_test.cc DEPS scope_lite
)
lite_cc_test
(
test_scope_lite SRCS scope_test.cc DEPS scope_lite
)
lite_cc_test
(
test_kernel_lite SRCS kernel_test.cc DEPS kernel_lite target_wrapper_lite
)
lite_cc_test
(
test_kernel_lite SRCS kernel_test.cc DEPS kernel_lite target_wrapper_lite
any_lite
)
lite_cc_test
(
test_op_lite SRCS op_lite_test.cc DEPS op_lite
)
lite_cc_test
(
test_op_lite SRCS op_lite_test.cc DEPS op_lite
)
lite_cc_test
(
test_tensor_lite SRCS lite_tensor_test.cc DEPS lite_tensor
)
lite_cc_test
(
test_tensor_lite SRCS lite_tensor_test.cc DEPS lite_tensor
)
lite_cc_test
(
test_type_system SRCS type_system_test.cc DEPS type_system utils_lite
)
lite_cc_test
(
test_type_system SRCS type_system_test.cc DEPS type_system utils_lite
)
...
...
paddle/fluid/lite/core/memory.cc
浏览文件 @
4adb6195
...
@@ -47,7 +47,7 @@ void TargetFree(TargetType target, void* data) {
...
@@ -47,7 +47,7 @@ void TargetFree(TargetType target, void* data) {
#ifdef LITE_WITH_CUDA
#ifdef LITE_WITH_CUDA
case
TargetType
::
kCUDA
:
case
TargetType
::
kCUDA
:
TargetWrapper
<
TARGET
(
k
X86
)
>::
Free
(
data
);
TargetWrapper
<
TARGET
(
k
CUDA
)
>::
Free
(
data
);
break
;
break
;
#endif // LITE_WITH_CUDA
#endif // LITE_WITH_CUDA
default:
default:
...
...
paddle/fluid/lite/model_parser/CMakeLists.txt
浏览文件 @
4adb6195
...
@@ -17,6 +17,7 @@ endif(LITE_WITH_LIGHT_WEIGHT_FRAMEWORK)
...
@@ -17,6 +17,7 @@ endif(LITE_WITH_LIGHT_WEIGHT_FRAMEWORK)
set
(
model_parser_deps variable_lite scope_lite
${
tensor_lite
}
scope_lite
set
(
model_parser_deps variable_lite scope_lite
${
tensor_lite
}
scope_lite
target_wrapper_host
target_wrapper_host
compatible_pb_lite
compatible_pb_lite
memory_lite
)
)
if
(
LITE_WITH_CUDA
)
if
(
LITE_WITH_CUDA
)
set
(
model_parser_deps
${
model_parser_deps
}
target_wrapper_cuda
)
set
(
model_parser_deps
${
model_parser_deps
}
target_wrapper_cuda
)
...
@@ -24,4 +25,3 @@ endif()
...
@@ -24,4 +25,3 @@ endif()
cc_library
(
model_parser_lite SRCS model_parser.cc DEPS
${
model_parser_deps
}
)
cc_library
(
model_parser_lite SRCS model_parser.cc DEPS
${
model_parser_deps
}
)
add_subdirectory
(
pb
)
add_subdirectory
(
pb
)
paddle/fluid/lite/operators/CMakeLists.txt
浏览文件 @
4adb6195
...
@@ -10,7 +10,7 @@ cc_library(io_copy_op_lite SRCS io_copy_op.cc DEPS ${op_DEPS})
...
@@ -10,7 +10,7 @@ cc_library(io_copy_op_lite SRCS io_copy_op.cc DEPS ${op_DEPS})
cc_library
(
activation_ops_lite SRCS activation_ops.cc DEPS
${
op_DEPS
}
)
cc_library
(
activation_ops_lite SRCS activation_ops.cc DEPS
${
op_DEPS
}
)
cc_library
(
elementwise_ops_lite SRCS elementwise_ops.cc DEPS
${
op_DEPS
}
)
cc_library
(
elementwise_ops_lite SRCS elementwise_ops.cc DEPS
${
op_DEPS
}
)
cc_library
(
op_params_lite SRCS op_params.cc DEPS
${
tensor_lite
}
)
cc_library
(
op_params_lite SRCS op_params.cc DEPS
${
tensor_lite
}
any_lite
)
set
(
ops_lite
set
(
ops_lite
fc_op_lite
fc_op_lite
relu_op_lite
relu_op_lite
...
@@ -21,5 +21,4 @@ set(ops_lite
...
@@ -21,5 +21,4 @@ set(ops_lite
io_copy_op_lite
io_copy_op_lite
PARENT_SCOPE
)
PARENT_SCOPE
)
lite_cc_test
(
test_fc_op_lite SRCS fc_op_test.cc DEPS fc_op_lite
)
lite_cc_test
(
test_fc_op_lite SRCS fc_op_test.cc DEPS fc_op_lite memory_lite
)
paddle/fluid/lite/operators/fc_op_test.cc
浏览文件 @
4adb6195
...
@@ -47,7 +47,7 @@ TEST(fc_op_lite, test) {
...
@@ -47,7 +47,7 @@ TEST(fc_op_lite, test) {
}
}
// prepare op desc
// prepare op desc
framework
::
OpDesc
desc
;
lite
::
OpDesc
desc
;
desc
.
SetType
(
"fc"
);
desc
.
SetType
(
"fc"
);
desc
.
SetInput
(
"Input"
,
{
"x"
});
desc
.
SetInput
(
"Input"
,
{
"x"
});
desc
.
SetInput
(
"W"
,
{
"w"
});
desc
.
SetInput
(
"W"
,
{
"w"
});
...
@@ -59,12 +59,8 @@ TEST(fc_op_lite, test) {
...
@@ -59,12 +59,8 @@ TEST(fc_op_lite, test) {
fc
.
SetValidPlaces
({
Place
{
TARGET
(
kHost
),
PRECISION
(
kFloat
)}});
fc
.
SetValidPlaces
({
Place
{
TARGET
(
kHost
),
PRECISION
(
kFloat
)}});
fc
.
Attach
(
desc
,
&
scope
);
fc
.
Attach
(
desc
,
&
scope
);
auto
kernels
=
fc
.
CreateKernels
({
Place
{
TARGET
(
kHost
),
PRECISION
(
kFloat
)}});
ASSERT_FALSE
(
kernels
.
empty
());
}
}
}
// namespace operators
}
// namespace operators
}
// namespace lite
}
// namespace lite
}
// namespace paddle
}
// namespace paddle
USE_LITE_KERNEL
(
fc
,
kHost
,
kFloat
,
kNCHW
,
def
);
paddle/fluid/lite/tools/build.sh
0 → 100755
浏览文件 @
4adb6195
#!/bin/bash
set
-e
TESTS_FILE
=
""
readonly
common_flags
=
"-DWITH_LITE=ON -DLITE_WITH_LIGHT_WEIGHT_FRAMEWORK=OFF -DWITH_PYTHON=OFF -DWITH_TESTING=ON -DLITE_WITH_ARM=OFF"
function
cmake_x86
{
cmake ..
-DWITH_GPU
=
OFF
-DLITE_WITH_X86
=
ON
${
common_flags
}
make test_cxx_api_lite
-j8
}
function
cmake_gpu
{
cmake ..
" -DWITH_GPU=ON {common_flags} -DLITE_WITH_GPU=ON"
make test_cxx_api_lite
-j8
}
function
cmake_arm
{
cmake ..
\
-DWITH_GPU
=
OFF
\
-DWITH_LITE
=
ON
\
-DLITE_WITH_X86
=
OFF
\
-DLITE_WITH_CUDA
=
OFF
\
-DLITE_WITH_LIGHT_WEIGHT_FRAMEWORK
=
ON
\
-DWITH_TESTING
=
ON
\
-DWITH_MKLDNN
=
OFF
}
function
build
{
file
=
$1
for
_test
in
$(
cat
$file
)
;
do
make
$_test
-j8
done
}
# It will eagerly test all lite related unittests.
function
test_lite
{
local
file
=
$1
echo
"file:
${
file
}
"
for
_test
in
$(
cat
$file
)
;
do
ctest
-R
$_test
-V
done
}
# Run test on mobile
function
test_mobile
{
# TODO(XXX) Implement this
local
file
=
$1
}
############################# MAIN #################################
function
print_usage
{
echo
-e
"
\n
USAGE:"
echo
echo
"----------------------------------------"
echo
-e
"cmake_x86: run cmake with X86 mode"
echo
-e
"cmake_cuda: run cmake with CUDA mode"
echo
-e
"cmake_arm: run cmake with ARM mode"
echo
echo
-e
"build: compile the tests"
echo
echo
-e
"test_server: run server tests"
echo
-e
"test_mobile: run mobile tests"
echo
"----------------------------------------"
echo
}
function
main
{
# Parse command line.
for
i
in
"
$@
"
;
do
case
$i
in
--tests
=
*
)
TESTS_FILE
=
"
${
i
#*=
}
"
shift
;;
build
)
build
$TESTS_FILE
shift
;;
cmake_x86
)
cmake_x86
shift
;;
cmake_cuda
)
cmake_cuda
shift
;;
cmake_arm
)
cmake_arm
shift
;;
test_server
)
test_lite
$TESTS_FILE
shift
;;
test_mobile
)
test_lite
$TESTS_FILE
shift
;;
*
)
# unknown option
print_usage
exit
1
;;
esac
done
}
print_usage
main
$@
paddle/fluid/lite/utils/CMakeLists.txt
浏览文件 @
4adb6195
...
@@ -9,4 +9,3 @@ set(utils_DEPS glog)
...
@@ -9,4 +9,3 @@ set(utils_DEPS glog)
lite_cc_test
(
test_varient SRCS varient_test.cc DEPS utils_lite
)
lite_cc_test
(
test_varient SRCS varient_test.cc DEPS utils_lite
)
cc_library
(
any_lite SRCS any.cc
)
cc_library
(
any_lite SRCS any.cc
)
cc_library
(
utils_lite SRCS cp_logging.cc DEPS
${
utils_DEPS
}
any_lite
)
cc_library
(
utils_lite SRCS cp_logging.cc DEPS
${
utils_DEPS
}
any_lite
)
paddle/fluid/lite/utils/varient.h
浏览文件 @
4adb6195
...
@@ -116,8 +116,9 @@ struct variant {
...
@@ -116,8 +116,9 @@ struct variant {
if
(
type_id
==
typeid
(
T
).
hash_code
())
if
(
type_id
==
typeid
(
T
).
hash_code
())
return
*
reinterpret_cast
<
const
T
*>
(
&
data
);
return
*
reinterpret_cast
<
const
T
*>
(
&
data
);
else
else
LOG
(
FATAL
)
<<
"unmatched type get, should be "
<<
type_id
<<
" but get "
throw
std
::
invalid_argument
(
"unmatched type"
);
<<
typeid
(
T
).
name
();
// LOG(FATAL) << "unmatched type get, should be " << type_id << " but get "
// << typeid(T).name();
return
*
reinterpret_cast
<
const
T
*>
(
&
data
);
return
*
reinterpret_cast
<
const
T
*>
(
&
data
);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录