Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
Paddle
提交
90ffe749
P
Paddle
项目概览
BaiXuePrincess
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
90ffe749
编写于
1月 29, 2019
作者:
Z
Zhaolong Xing
提交者:
GitHub
1月 29, 2019
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #15546 from NHZlX/fix_trt_utest_random_failed
fix trt models utest failed.
上级
c7449227
95b98f27
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
7 addition
and
11 deletion
+7
-11
paddle/fluid/inference/tests/api/tester_helper.h
paddle/fluid/inference/tests/api/tester_helper.h
+4
-9
paddle/fluid/inference/tests/api/trt_models_tester.cc
paddle/fluid/inference/tests/api/trt_models_tester.cc
+3
-2
未找到文件。
paddle/fluid/inference/tests/api/tester_helper.h
浏览文件 @
90ffe749
...
@@ -56,13 +56,6 @@ DECLARE_int32(paddle_num_threads);
...
@@ -56,13 +56,6 @@ DECLARE_int32(paddle_num_threads);
namespace
paddle
{
namespace
paddle
{
namespace
inference
{
namespace
inference
{
float
Random
(
float
low
,
float
high
)
{
static
std
::
random_device
rd
;
static
std
::
mt19937
mt
(
rd
());
std
::
uniform_real_distribution
<
double
>
dist
(
low
,
high
);
return
dist
(
mt
);
}
void
PrintConfig
(
const
PaddlePredictor
::
Config
*
config
,
bool
use_analysis
)
{
void
PrintConfig
(
const
PaddlePredictor
::
Config
*
config
,
bool
use_analysis
)
{
const
auto
*
analysis_config
=
const
auto
*
analysis_config
=
reinterpret_cast
<
const
AnalysisConfig
*>
(
config
);
reinterpret_cast
<
const
AnalysisConfig
*>
(
config
);
...
@@ -146,7 +139,8 @@ void SetFakeImageInput(std::vector<std::vector<PaddleTensor>> *inputs,
...
@@ -146,7 +139,8 @@ void SetFakeImageInput(std::vector<std::vector<PaddleTensor>> *inputs,
const
std
::
string
&
dirname
,
bool
is_combined
=
true
,
const
std
::
string
&
dirname
,
bool
is_combined
=
true
,
std
::
string
model_filename
=
"model"
,
std
::
string
model_filename
=
"model"
,
std
::
string
params_filename
=
"params"
,
std
::
string
params_filename
=
"params"
,
const
std
::
vector
<
std
::
string
>
*
feed_names
=
nullptr
)
{
const
std
::
vector
<
std
::
string
>
*
feed_names
=
nullptr
,
const
int
continuous_inuput_index
=
0
)
{
// Set fake_image_data
// Set fake_image_data
PADDLE_ENFORCE_EQ
(
FLAGS_test_all_data
,
0
,
"Only have single batch of data."
);
PADDLE_ENFORCE_EQ
(
FLAGS_test_all_data
,
0
,
"Only have single batch of data."
);
std
::
vector
<
std
::
vector
<
int64_t
>>
feed_target_shapes
=
GetFeedTargetShapes
(
std
::
vector
<
std
::
vector
<
int64_t
>>
feed_target_shapes
=
GetFeedTargetShapes
(
...
@@ -183,7 +177,8 @@ void SetFakeImageInput(std::vector<std::vector<PaddleTensor>> *inputs,
...
@@ -183,7 +177,8 @@ void SetFakeImageInput(std::vector<std::vector<PaddleTensor>> *inputs,
float
*
input_data
=
static_cast
<
float
*>
(
input
.
data
.
data
());
float
*
input_data
=
static_cast
<
float
*>
(
input
.
data
.
data
());
// fill input data, for profile easily, do not use random data here.
// fill input data, for profile easily, do not use random data here.
for
(
size_t
j
=
0
;
j
<
len
;
++
j
)
{
for
(
size_t
j
=
0
;
j
<
len
;
++
j
)
{
*
(
input_data
+
j
)
=
Random
(
0.0
,
1.0
)
/
10.
;
*
(
input_data
+
j
)
=
static_cast
<
float
>
((
j
+
continuous_inuput_index
)
%
len
)
/
len
;
}
}
}
}
(
*
inputs
).
emplace_back
(
input_slots
);
(
*
inputs
).
emplace_back
(
input_slots
);
...
...
paddle/fluid/inference/tests/api/trt_models_tester.cc
浏览文件 @
90ffe749
...
@@ -119,9 +119,10 @@ void compare_continuous_input(std::string model_dir, bool use_tensorrt) {
...
@@ -119,9 +119,10 @@ void compare_continuous_input(std::string model_dir, bool use_tensorrt) {
std
::
vector
<
std
::
vector
<
PaddleTensor
>>
inputs_all
;
std
::
vector
<
std
::
vector
<
PaddleTensor
>>
inputs_all
;
if
(
!
FLAGS_prog_filename
.
empty
()
&&
!
FLAGS_param_filename
.
empty
())
{
if
(
!
FLAGS_prog_filename
.
empty
()
&&
!
FLAGS_param_filename
.
empty
())
{
SetFakeImageInput
(
&
inputs_all
,
model_dir
,
true
,
FLAGS_prog_filename
,
SetFakeImageInput
(
&
inputs_all
,
model_dir
,
true
,
FLAGS_prog_filename
,
FLAGS_param_filename
);
FLAGS_param_filename
,
nullptr
,
i
);
}
else
{
}
else
{
SetFakeImageInput
(
&
inputs_all
,
model_dir
,
false
,
"__model__"
,
""
);
SetFakeImageInput
(
&
inputs_all
,
model_dir
,
false
,
"__model__"
,
""
,
nullptr
,
i
);
}
}
CompareNativeAndAnalysis
(
native_pred
.
get
(),
analysis_pred
.
get
(),
CompareNativeAndAnalysis
(
native_pred
.
get
(),
analysis_pred
.
get
(),
inputs_all
);
inputs_all
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录