Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
机器未来
Paddle
提交
656124da
P
Paddle
项目概览
机器未来
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
656124da
编写于
2月 19, 2021
作者:
W
Wilber
提交者:
GitHub
2月 19, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
cherry-pick pr (#31043)
上级
25ee1a73
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
41 addition
and
2 deletion
+41
-2
paddle/fluid/inference/api/analysis_predictor.cc
paddle/fluid/inference/api/analysis_predictor.cc
+7
-0
paddle/fluid/inference/api/paddle_pass_builder.cc
paddle/fluid/inference/api/paddle_pass_builder.cc
+5
-1
paddle/fluid/inference/tensorrt/engine.h
paddle/fluid/inference/tensorrt/engine.h
+25
-0
paddle/fluid/pybind/inference_api.cc
paddle/fluid/pybind/inference_api.cc
+4
-1
未找到文件。
paddle/fluid/inference/api/analysis_predictor.cc
浏览文件 @
656124da
...
@@ -631,6 +631,13 @@ std::unique_ptr<PaddlePredictor> CreatePaddlePredictor<
...
@@ -631,6 +631,13 @@ std::unique_ptr<PaddlePredictor> CreatePaddlePredictor<
process_level_allocator_enabled
=
true
;
process_level_allocator_enabled
=
true
;
}
}
// TODO(wilber): jetson tx2 may fail to run the model due to insufficient memory
// under the native_best_fit strategy. Modify the default allocation strategy to
// auto_growth. todo, find a more appropriate way to solve the problem.
#ifdef WITH_NV_JETSON
gflags
.
push_back
(
"--allocator_strategy=auto_growth"
);
#endif
if
(
framework
::
InitGflags
(
gflags
))
{
if
(
framework
::
InitGflags
(
gflags
))
{
VLOG
(
3
)
<<
"The following gpu analysis configurations only take effect "
VLOG
(
3
)
<<
"The following gpu analysis configurations only take effect "
"for the first predictor: "
;
"for the first predictor: "
;
...
...
paddle/fluid/inference/api/paddle_pass_builder.cc
浏览文件 @
656124da
...
@@ -95,9 +95,13 @@ const std::vector<std::string> kTRTSubgraphPasses({
...
@@ -95,9 +95,13 @@ const std::vector<std::string> kTRTSubgraphPasses({
"conv_bn_fuse_pass"
,
//
"conv_bn_fuse_pass"
,
//
#if CUDNN_VERSION >= 7100 // To run conv_fusion, the version of cudnn must be
#if CUDNN_VERSION >= 7100 // To run conv_fusion, the version of cudnn must be
// guaranteed at least v7
// guaranteed at least v7
// cudnn8.0 has memory leak problem in conv + eltwise + act, so we
// disable the pass.
#if !(CUDNN_VERSION >= 8000 && CUDNN_VERSION < 8100)
"conv_elementwise_add_act_fuse_pass"
,
//
"conv_elementwise_add_act_fuse_pass"
,
//
"conv_elementwise_add2_act_fuse_pass"
,
//
"conv_elementwise_add2_act_fuse_pass"
,
//
#endif //
#endif
#endif
"transpose_flatten_concat_fuse_pass"
,
"transpose_flatten_concat_fuse_pass"
,
});
});
...
...
paddle/fluid/inference/tensorrt/engine.h
浏览文件 @
656124da
...
@@ -81,10 +81,35 @@ nvinfer1::Dims Vec2TRT_Dims(const std::vector<T>& shape, std::string input,
...
@@ -81,10 +81,35 @@ nvinfer1::Dims Vec2TRT_Dims(const std::vector<T>& shape, std::string input,
"TensorRT's tensor input requires at most 4 "
"TensorRT's tensor input requires at most 4 "
"dimensions, but input %s has %d dims."
,
"dimensions, but input %s has %d dims."
,
input
,
shape
.
size
()));
input
,
shape
.
size
()));
auto
ShapeStr
=
[](
const
std
::
vector
<
T
>&
shape
)
{
std
::
ostringstream
os
;
os
<<
"["
;
for
(
size_t
i
=
0
;
i
<
shape
.
size
();
++
i
)
{
if
(
i
==
shape
.
size
()
-
1
)
{
os
<<
shape
[
i
];
}
else
{
os
<<
shape
[
i
]
<<
","
;
}
}
os
<<
"]"
;
return
os
.
str
();
};
if
(
!
with_dynamic_shape
)
{
if
(
!
with_dynamic_shape
)
{
if
(
shape
.
size
()
==
4UL
)
{
if
(
shape
.
size
()
==
4UL
)
{
if
(
shape
[
2
]
==
-
1
||
shape
[
3
]
==
-
1
)
{
PADDLE_THROW
(
platform
::
errors
::
InvalidArgument
(
"The input [%s] shape of trt subgraph is %s, please enable "
"trt dynamic_shape mode by SetTRTDynamicShapeInfo."
,
input
,
ShapeStr
(
shape
)));
}
return
nvinfer1
::
DimsCHW
(
shape
[
1
],
shape
[
2
],
shape
[
3
]);
return
nvinfer1
::
DimsCHW
(
shape
[
1
],
shape
[
2
],
shape
[
3
]);
}
else
if
(
shape
.
size
()
==
3UL
)
{
}
else
if
(
shape
.
size
()
==
3UL
)
{
if
(
shape
[
1
]
==
-
1
||
shape
[
2
]
==
-
1
)
{
PADDLE_THROW
(
platform
::
errors
::
InvalidArgument
(
"The input [%s] shape of trt subgraph is %s, please enable "
"trt dynamic_shape mode by SetTRTDynamicShapeInfo."
,
input
,
ShapeStr
(
shape
)));
}
return
nvinfer1
::
Dims2
(
shape
[
1
],
shape
[
2
]);
return
nvinfer1
::
Dims2
(
shape
[
1
],
shape
[
2
]);
}
}
return
nvinfer1
::
DimsCHW
(
shape
[
1
],
1
,
1
);
return
nvinfer1
::
DimsCHW
(
shape
[
1
],
1
,
1
);
...
...
paddle/fluid/pybind/inference_api.cc
浏览文件 @
656124da
...
@@ -534,7 +534,10 @@ void BindAnalysisConfig(py::module *m) {
...
@@ -534,7 +534,10 @@ void BindAnalysisConfig(py::module *m) {
[](
AnalysisConfig
&
self
,
const
std
::
string
&
pass
)
{
[](
AnalysisConfig
&
self
,
const
std
::
string
&
pass
)
{
self
.
pass_builder
()
->
DeletePass
(
pass
);
self
.
pass_builder
()
->
DeletePass
(
pass
);
})
})
.
def
(
"pass_builder"
,
&
AnalysisConfig
::
pass_builder
,
.
def
(
"pass_builder"
,
[](
AnalysisConfig
&
self
)
{
return
dynamic_cast
<
PaddlePassBuilder
*>
(
self
.
pass_builder
());
},
py
::
return_value_policy
::
reference
);
py
::
return_value_policy
::
reference
);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录