Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
Paddle
提交
602d2ce5
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看板
未验证
提交
602d2ce5
编写于
10月 21, 2020
作者:
P
Pei Yang
提交者:
GitHub
10月 21, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
change avg pooling from trt plugin to trt layer (#28032)
上级
5289b72a
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
5 addition
and
2 deletion
+5
-2
paddle/fluid/inference/tensorrt/convert/pool2d_op.cc
paddle/fluid/inference/tensorrt/convert/pool2d_op.cc
+5
-2
未找到文件。
paddle/fluid/inference/tensorrt/convert/pool2d_op.cc
浏览文件 @
602d2ce5
...
@@ -88,6 +88,9 @@ class Pool2dOpConverter : public OpConverter {
...
@@ -88,6 +88,9 @@ class Pool2dOpConverter : public OpConverter {
BOOST_GET_CONST
(
std
::
vector
<
int
>
,
op_desc
.
GetAttr
(
"strides"
));
BOOST_GET_CONST
(
std
::
vector
<
int
>
,
op_desc
.
GetAttr
(
"strides"
));
std
::
vector
<
int
>
paddings
=
std
::
vector
<
int
>
paddings
=
BOOST_GET_CONST
(
std
::
vector
<
int
>
,
op_desc
.
GetAttr
(
"paddings"
));
BOOST_GET_CONST
(
std
::
vector
<
int
>
,
op_desc
.
GetAttr
(
"paddings"
));
bool
exclusive
=
op_desc
.
HasAttr
(
"exclusive"
)
?
BOOST_GET_CONST
(
bool
,
op_desc
.
GetAttr
(
"exclusive"
))
:
true
;
bool
ceil_mode
=
BOOST_GET_CONST
(
bool
,
op_desc
.
GetAttr
(
"ceil_mode"
));
bool
ceil_mode
=
BOOST_GET_CONST
(
bool
,
op_desc
.
GetAttr
(
"ceil_mode"
));
bool
adaptive
=
false
;
bool
adaptive
=
false
;
if
(
op_desc
.
HasAttr
(
"adaptive"
))
if
(
op_desc
.
HasAttr
(
"adaptive"
))
...
@@ -166,7 +169,7 @@ class Pool2dOpConverter : public OpConverter {
...
@@ -166,7 +169,7 @@ class Pool2dOpConverter : public OpConverter {
return
;
return
;
}
}
if
(
!
adaptive
&&
pool_type
==
"max"
)
{
if
(
!
adaptive
)
{
// Under ceil mode, the pre_pad and post_pad are used to
// Under ceil mode, the pre_pad and post_pad are used to
// record the the padding size. In some ceil mode cases,
// record the the padding size. In some ceil mode cases,
// we do not need padding, so we initialize the two vars to 0.
// we do not need padding, so we initialize the two vars to 0.
...
@@ -194,6 +197,7 @@ class Pool2dOpConverter : public OpConverter {
...
@@ -194,6 +197,7 @@ class Pool2dOpConverter : public OpConverter {
"trt pool layer in converter could not be created."
));
"trt pool layer in converter could not be created."
));
pool_layer
->
setStride
(
nv_strides
);
pool_layer
->
setStride
(
nv_strides
);
pool_layer
->
setPadding
(
nv_paddings
);
pool_layer
->
setPadding
(
nv_paddings
);
pool_layer
->
setAverageCountExcludesPadding
(
exclusive
);
layer
=
pool_layer
;
layer
=
pool_layer
;
}
else
{
}
else
{
// Average pooling needs to exclude the padding pixels from the average
// Average pooling needs to exclude the padding pixels from the average
...
@@ -213,7 +217,6 @@ class Pool2dOpConverter : public OpConverter {
...
@@ -213,7 +217,6 @@ class Pool2dOpConverter : public OpConverter {
"trt pool plugin layer in converter could not be created."
));
"trt pool plugin layer in converter could not be created."
));
layer
=
pool_layer
;
layer
=
pool_layer
;
}
}
auto
output_name
=
op_desc
.
Output
(
"Out"
)[
0
];
auto
output_name
=
op_desc
.
Output
(
"Out"
)[
0
];
RreplenishLayerAndOutput
(
layer
,
"pool2d"
,
{
output_name
},
test_mode
);
RreplenishLayerAndOutput
(
layer
,
"pool2d"
,
{
output_name
},
test_mode
);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录