Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Crayon鑫
Paddle
提交
85e697d7
P
Paddle
项目概览
Crayon鑫
/
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看板
未验证
提交
85e697d7
编写于
4月 27, 2021
作者:
P
Pei Yang
提交者:
GitHub
4月 27, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
support depthwise_conv2d_transpose (#32593)
上级
809ac036
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
29 addition
and
5 deletion
+29
-5
paddle/fluid/inference/tensorrt/convert/conv2d_op.cc
paddle/fluid/inference/tensorrt/convert/conv2d_op.cc
+1
-1
paddle/fluid/inference/tensorrt/convert/op_converter.h
paddle/fluid/inference/tensorrt/convert/op_converter.h
+6
-0
paddle/fluid/inference/tensorrt/op_teller.cc
paddle/fluid/inference/tensorrt/op_teller.cc
+5
-2
python/paddle/fluid/tests/unittests/ir/inference/test_trt_conv_pass.py
.../fluid/tests/unittests/ir/inference/test_trt_conv_pass.py
+17
-2
未找到文件。
paddle/fluid/inference/tensorrt/convert/conv2d_op.cc
浏览文件 @
85e697d7
...
...
@@ -160,7 +160,7 @@ class Deconv2dOpConverter : public OpConverter {
nvinfer1
::
DimsHW
&
ksize
,
TensorRTEngine
::
Weight
&
weight
,
TensorRTEngine
::
Weight
&
bias
)
->
nvinfer1
::
IDeconvolutionLayer
*
{
auto
*
layer
=
TRT_ENGINE_ADD_LAYER
(
engine_
,
Deconvolution
,
*
inputs
,
n_
in
put
,
TRT_ENGINE_ADD_LAYER
(
engine_
,
Deconvolution
,
*
inputs
,
n_
out
put
,
ksize
,
weight
.
get
(),
bias
.
get
());
return
layer
;
},
...
...
paddle/fluid/inference/tensorrt/convert/op_converter.h
浏览文件 @
85e697d7
...
...
@@ -109,6 +109,12 @@ class OpConverter {
it
,
platform
::
errors
::
Unimplemented
(
"no OpConverter for optype [%s]"
,
op_desc
.
Type
()));
}
if
(
op_desc
.
Type
()
==
"depthwise_conv2d_transpose"
)
{
it
=
Registry
<
OpConverter
>::
Global
().
Lookup
(
"conv2d_transpose"
);
PADDLE_ENFORCE_NOT_NULL
(
it
,
platform
::
errors
::
Unimplemented
(
"no OpConverter for optype [%s]"
,
op_desc
.
Type
()));
}
if
(
op_desc
.
Type
()
==
"transpose2"
)
{
it
=
Registry
<
OpConverter
>::
Global
().
Lookup
(
"transpose"
);
PADDLE_ENFORCE_NOT_NULL
(
...
...
paddle/fluid/inference/tensorrt/op_teller.cc
浏览文件 @
85e697d7
...
...
@@ -102,6 +102,7 @@ struct SimpleOpTypeSetTeller : public Teller {
"dropout"
,
"prelu"
,
"conv2d_transpose"
,
"depthwise_conv2d_transpose"
,
"leaky_relu"
,
"fc"
,
"shuffle_channel"
,
...
...
@@ -172,7 +173,8 @@ bool OpTeller::Tell(const framework::ir::Node* node, bool use_no_calib_int8,
}
if
(
op_type
==
"conv2d"
||
op_type
==
"conv2d_transpose"
||
op_type
==
"conv2d_fusion"
)
{
op_type
==
"conv2d_fusion"
||
op_type
==
"depthwise_conv2d"
||
op_type
==
"depthwise_conv2d_transpose"
)
{
std
::
vector
<
int
>
paddings
=
BOOST_GET_CONST
(
std
::
vector
<
int
>
,
desc
.
GetAttr
(
"paddings"
));
...
...
@@ -202,7 +204,8 @@ bool OpTeller::Tell(const framework::ir::Node* node, bool use_no_calib_int8,
}
}
if
(
op_type
==
"conv2d_transpose"
)
{
if
(
op_type
==
"conv2d_transpose"
||
op_type
==
"depthwise_conv2d_transpose"
)
{
if
(
!
desc
.
HasAttr
(
"dilations"
))
{
return
false
;
}
else
{
...
...
python/paddle/fluid/tests/unittests/ir/inference/test_trt_conv_pass.py
浏览文件 @
85e697d7
...
...
@@ -96,6 +96,7 @@ class TensorRTSubgraphPassConvTransposeTest(InferencePassTest):
groups
=
self
.
conv_groups
,
padding
=
self
.
conv_padding
,
bias_attr
=
False
,
use_cudnn
=
self
.
use_cudnn
,
act
=
None
)
self
.
feeds
=
{
"data"
:
np
.
random
.
random
([
1
,
6
,
64
,
64
]).
astype
(
"float32"
),
...
...
@@ -110,6 +111,7 @@ class TensorRTSubgraphPassConvTransposeTest(InferencePassTest):
self
.
conv_filter_size
=
6
self
.
conv_groups
=
1
self
.
conv_padding
=
[
1
,
1
]
self
.
use_cudnn
=
True
def
test_check_output
(
self
):
if
core
.
is_compiled_with_cuda
():
...
...
@@ -126,6 +128,7 @@ class TensorRTSubgraphPassConvTransposeValidPaddingTest(
self
.
conv_filter_size
=
6
self
.
conv_groups
=
1
self
.
conv_padding
=
'VALID'
self
.
use_cudnn
=
True
class
TensorRTSubgraphPassConvTransposeSamePaddingTest
(
...
...
@@ -135,15 +138,27 @@ class TensorRTSubgraphPassConvTransposeSamePaddingTest(
self
.
conv_filter_size
=
6
self
.
conv_groups
=
1
self
.
conv_padding
=
'SAME'
self
.
use_cudnn
=
True
class
TensorRTSubgraphPass
DepthwiseConvTranspose
Test
(
class
TensorRTSubgraphPass
ConvTransposeMultiGroup
Test
(
TensorRTSubgraphPassConvTransposeTest
):
def
set_params
(
self
):
self
.
conv_num_filters
=
6
self
.
conv_filter_size
=
6
self
.
conv_groups
=
1
self
.
conv_groups
=
2
self
.
conv_padding
=
[
1
,
1
]
self
.
use_cudnn
=
True
class
TensorRTSubgraphPassDepthwiseConvTransposeTest
(
TensorRTSubgraphPassConvTransposeTest
):
def
set_params
(
self
):
self
.
conv_num_filters
=
6
self
.
conv_filter_size
=
4
self
.
conv_groups
=
6
self
.
conv_padding
=
[
1
,
1
]
self
.
use_cudnn
=
False
if
__name__
==
"__main__"
:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录