Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
5750152e
P
Paddle
项目概览
PaddlePaddle
/
Paddle
1 年多 前同步成功
通知
2302
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看板
未验证
提交
5750152e
编写于
1月 11, 2020
作者:
W
Wilber
提交者:
GitHub
1月 11, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
support fluid-lite subgraph run resnet test=develop (#22191)
- 添加了fluid-lite子图方式运行resnet的单测 - 修改了依赖Lite的git commit id
上级
8de33f41
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
75 addition
and
1 deletion
+75
-1
cmake/external/lite.cmake
cmake/external/lite.cmake
+1
-1
paddle/fluid/inference/tests/api/CMakeLists.txt
paddle/fluid/inference/tests/api/CMakeLists.txt
+3
-0
paddle/fluid/inference/tests/api/lite_resnet50_test.cc
paddle/fluid/inference/tests/api/lite_resnet50_test.cc
+71
-0
未找到文件。
cmake/external/lite.cmake
浏览文件 @
5750152e
...
...
@@ -43,7 +43,7 @@ if (NOT LITE_SOURCE_DIR OR NOT LITE_BINARY_DIR)
${
LITE_PROJECT
}
${
EXTERNAL_PROJECT_LOG_ARGS
}
GIT_REPOSITORY
"https://github.com/PaddlePaddle/Paddle-Lite.git"
GIT_TAG
947cda26637d46dc23f4e39d2b52e7d9a1fa6eef
GIT_TAG
b30dc65b264f7bc3753ba862ff4e529ea2af6665
PREFIX
${
LITE_SOURCES_DIR
}
UPDATE_COMMAND
""
BUILD_COMMAND
${
LITE_BUILD_COMMAND
}
...
...
paddle/fluid/inference/tests/api/CMakeLists.txt
浏览文件 @
5750152e
...
...
@@ -367,6 +367,9 @@ download_data(${LITE_MODEL_INSTALL_DIR} "mul_model_fp32.tgz")
inference_analysis_test
(
lite_mul_model_test SRCS lite_mul_model_test.cc
EXTRA_DEPS
${
INFERENCE_EXTRA_DEPS
}
ARGS --infer_model=
${
LITE_MODEL_INSTALL_DIR
}
)
inference_analysis_test
(
lite_resnet50_test SRCS lite_resnet50_test.cc
EXTRA_DEPS
${
INFERENCE_EXTRA_DEPS
}
ARGS --infer_model=
${
RESNET50_MODEL_DIR
}
)
inference_analysis_test
(
test_analyzer_capi SRCS analyzer_capi_tester.cc
EXTRA_DEPS
${
INFERENCE_EXTRA_DEPS
}
paddle_fluid_c
ARGS --infer_model=
${
RESNET50_MODEL_DIR
}
/model
)
...
...
paddle/fluid/inference/tests/api/lite_resnet50_test.cc
0 → 100644
浏览文件 @
5750152e
/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. */
#include <gflags/gflags.h>
#include <glog/logging.h>
#include <gtest/gtest.h>
#include <cmath>
#include "paddle/fluid/inference/tests/api/tester_helper.h"
namespace
paddle
{
namespace
inference
{
TEST
(
AnalysisPredictor
,
use_gpu
)
{
std
::
string
model_dir
=
FLAGS_infer_model
+
"/"
+
"model"
;
AnalysisConfig
config
;
config
.
EnableUseGpu
(
100
,
0
);
config
.
SetModel
(
model_dir
+
"/model"
,
model_dir
+
"/params"
);
config
.
EnableLiteEngine
(
paddle
::
AnalysisConfig
::
Precision
::
kFloat32
);
std
::
vector
<
PaddleTensor
>
inputs
;
auto
predictor
=
CreatePaddlePredictor
(
config
);
const
int
batch
=
1
;
const
int
channel
=
3
;
const
int
height
=
318
;
const
int
width
=
318
;
const
int
input_num
=
batch
*
channel
*
height
*
width
;
std
::
vector
<
float
>
input
(
input_num
,
1
);
PaddleTensor
in
;
in
.
shape
=
{
1
,
3
,
318
,
318
};
in
.
data
=
PaddleBuf
(
static_cast
<
void
*>
(
input
.
data
()),
input_num
*
sizeof
(
float
));
in
.
dtype
=
PaddleDType
::
FLOAT32
;
inputs
.
emplace_back
(
in
);
std
::
vector
<
PaddleTensor
>
outputs
;
ASSERT_TRUE
(
predictor
->
Run
(
inputs
,
&
outputs
));
const
std
::
vector
<
float
>
truth_values
=
{
127.780396
,
738.16656
,
1013.2264
,
-
438.17206
,
366.4022
,
927.66187
,
736.2241
,
-
633.68567
,
-
329.92737
,
-
430.15637
,
-
633.0639
,
-
146.54858
,
-
1324.2804
,
-
1349.3661
,
-
242.67671
,
117.44864
,
-
801.7251
,
-
391.51495
,
-
404.8202
,
454.16132
,
515.48206
,
-
133.03114
,
69.293076
,
590.09753
,
-
1434.6917
,
-
1070.8903
,
307.0744
,
400.52573
,
-
316.12177
,
-
587.1265
,
-
161.05742
,
800.3663
,
-
96.47157
,
748.708
,
868.17645
,
-
447.9403
,
112.73656
,
1127.1992
,
47.43518
,
677.7219
,
593.1881
,
-
336.4011
,
551.3634
,
397.82474
,
78.39835
,
-
715.4006
,
405.96988
,
404.25684
,
246.01978
,
-
8.430191
,
131.36617
,
-
648.0528
};
const
size_t
expected_size
=
1
;
EXPECT_EQ
(
outputs
.
size
(),
expected_size
);
float
*
data_o
=
static_cast
<
float
*>
(
outputs
[
0
].
data
.
data
());
for
(
size_t
j
=
0
;
j
<
outputs
[
0
].
data
.
length
()
/
sizeof
(
float
);
j
+=
10
)
{
EXPECT_NEAR
(
data_o
[
j
],
truth_values
[
j
/
10
],
6e-3
);
}
}
}
// namespace inference
}
// namespace paddle
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录