Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
Paddle
提交
b757466b
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看板
未验证
提交
b757466b
编写于
8月 19, 2020
作者:
P
Pei Yang
提交者:
GitHub
8月 19, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix trt dynamic ernie serialization unit test (#26228)
上级
ea6716a5
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
8 addition
and
13 deletion
+8
-13
paddle/fluid/framework/ir/subgraph_detector.cc
paddle/fluid/framework/ir/subgraph_detector.cc
+2
-1
paddle/fluid/inference/tests/api/CMakeLists.txt
paddle/fluid/inference/tests/api/CMakeLists.txt
+1
-10
paddle/fluid/inference/tests/api/trt_dynamic_shape_ernie_deserialize_test.cc
...nce/tests/api/trt_dynamic_shape_ernie_deserialize_test.cc
+4
-1
paddle/fluid/inference/tests/api/trt_dynamic_shape_ernie_test.cc
...fluid/inference/tests/api/trt_dynamic_shape_ernie_test.cc
+1
-1
未找到文件。
paddle/fluid/framework/ir/subgraph_detector.cc
浏览文件 @
b757466b
...
@@ -309,7 +309,8 @@ std::vector<std::vector<Node *>> SubgraphDetector::ExtractSubGraphs() {
...
@@ -309,7 +309,8 @@ std::vector<std::vector<Node *>> SubgraphDetector::ExtractSubGraphs() {
BriefNode
*
brief_node
=
itr
.
second
;
BriefNode
*
brief_node
=
itr
.
second
;
if
(
!
Agent
(
brief_node
->
node
).
marked
())
{
if
(
!
Agent
(
brief_node
->
node
).
marked
())
{
VLOG
(
4
)
<<
brief_node
->
node
->
id
()
<<
" node not a trt candidate."
;
VLOG
(
4
)
<<
brief_node
->
node
->
id
()
<<
" node named "
<<
brief_node
->
node
->
Name
()
<<
" is not a trt candidate."
;
continue
;
continue
;
}
}
...
...
paddle/fluid/inference/tests/api/CMakeLists.txt
浏览文件 @
b757466b
...
@@ -471,19 +471,10 @@ if(WITH_GPU AND TENSORRT_FOUND)
...
@@ -471,19 +471,10 @@ if(WITH_GPU AND TENSORRT_FOUND)
inference_download_and_uncompress
(
${
TEST_TRT_ERNIE_MODEL
}
${
INFERENCE_URL
}
/tensorrt_test
"ernie_model_4_unserialized.tgz"
)
inference_download_and_uncompress
(
${
TEST_TRT_ERNIE_MODEL
}
${
INFERENCE_URL
}
/tensorrt_test
"ernie_model_4_unserialized.tgz"
)
endif
()
endif
()
inference_analysis_test
(
test_trt_dynamic_shape_ernie_ser
ialize
SRCS trt_dynamic_shape_ernie_deserialize_test.cc
inference_analysis_test
(
test_trt_dynamic_shape_ernie_ser
_deser
SRCS trt_dynamic_shape_ernie_deserialize_test.cc
EXTRA_DEPS
${
INFERENCE_EXTRA_DEPS
}
EXTRA_DEPS
${
INFERENCE_EXTRA_DEPS
}
ARGS --infer_model=
${
TEST_TRT_ERNIE_MODEL
}
/ernie_model_4_unserialized
)
ARGS --infer_model=
${
TEST_TRT_ERNIE_MODEL
}
/ernie_model_4_unserialized
)
set
(
TEST_TRT_ERNIE_SER_MODEL
"
${
TRT_MODEL_INSTALL_DIR
}
/ernie_test/ernie_model_4_serialized/"
)
if
(
NOT EXISTS
${
TEST_TRT_ERNIE_SER_MODEL
}
)
inference_download_and_uncompress
(
${
TEST_TRT_ERNIE_MODEL
}
${
INFERENCE_URL
}
/tensorrt_test
"ernie_model_4_serialized.tgz"
)
endif
()
inference_analysis_test
(
test_trt_dynamic_shape_ernie_deserialize SRCS trt_dynamic_shape_ernie_deserialize_test.cc
EXTRA_DEPS
${
INFERENCE_EXTRA_DEPS
}
ARGS --infer_model=
${
TEST_TRT_ERNIE_MODEL
}
/ernie_model_4_serialized
)
endif
()
endif
()
set
(
LITE_MODEL_INSTALL_DIR
"
${
INFERENCE_DEMO_INSTALL_DIR
}
/lite"
)
set
(
LITE_MODEL_INSTALL_DIR
"
${
INFERENCE_DEMO_INSTALL_DIR
}
/lite"
)
...
...
paddle/fluid/inference/tests/api/trt_dynamic_shape_ernie_deserialize_test.cc
浏览文件 @
b757466b
...
@@ -123,8 +123,11 @@ void trt_ernie(bool with_fp16, std::vector<float> result) {
...
@@ -123,8 +123,11 @@ void trt_ernie(bool with_fp16, std::vector<float> result) {
config
.
EnableTensorRtEngine
(
1
<<
30
,
1
,
5
,
precision
,
true
,
false
);
config
.
EnableTensorRtEngine
(
1
<<
30
,
1
,
5
,
precision
,
true
,
false
);
config
.
SetTRTDynamicShapeInfo
(
min_input_shape
,
max_input_shape
,
config
.
SetTRTDynamicShapeInfo
(
min_input_shape
,
max_input_shape
,
opt_input_shape
);
opt_input_shape
);
AnalysisConfig
*
config_deser
=
new
AnalysisConfig
(
config
);
std
::
vector
<
float
>
out_data
;
std
::
vector
<
float
>
out_data
;
run
(
config
,
&
out_data
);
run
(
config
,
&
out_data
);
// serialize
run
(
*
config_deser
,
&
out_data
);
// deserialize
for
(
size_t
i
=
0
;
i
<
out_data
.
size
();
i
++
)
{
for
(
size_t
i
=
0
;
i
<
out_data
.
size
();
i
++
)
{
EXPECT_NEAR
(
result
[
i
],
out_data
[
i
],
1e-6
);
EXPECT_NEAR
(
result
[
i
],
out_data
[
i
],
1e-6
);
}
}
...
...
paddle/fluid/inference/tests/api/trt_dynamic_shape_ernie_test.cc
浏览文件 @
b757466b
...
@@ -126,7 +126,7 @@ void trt_ernie(bool with_fp16, std::vector<float> result) {
...
@@ -126,7 +126,7 @@ void trt_ernie(bool with_fp16, std::vector<float> result) {
std
::
vector
<
float
>
out_data
;
std
::
vector
<
float
>
out_data
;
run
(
config
,
&
out_data
);
run
(
config
,
&
out_data
);
for
(
size_t
i
=
0
;
i
<
out_data
.
size
();
i
++
)
{
for
(
size_t
i
=
0
;
i
<
out_data
.
size
();
i
++
)
{
EXPECT_NEAR
(
result
[
i
],
out_data
[
i
],
1e-
6
);
EXPECT_NEAR
(
result
[
i
],
out_data
[
i
],
1e-
5
);
}
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录