Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

【BUPT】【Paddle TensorRT No.18】Add pd_op.conv3d and pd_op.conv3d_transpose converter #69757

Closed
wants to merge 11 commits into from

Conversation

ZHOU05030
Copy link
Contributor

@ZHOU05030 ZHOU05030 commented Nov 27, 2024

PR Category

User Experience

PR Types

New features

Description

新增pd_op.conv3d and pd_op.conv3d_transpose

Copy link

paddle-bot bot commented Nov 27, 2024

你的PR提交成功,感谢你对开源项目的贡献!
请关注后续CI自动化测试结果,详情请参考Paddle-CI手册
Your PR has been submitted. Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

@paddle-bot paddle-bot bot added the contributor External developers label Nov 27, 2024
@luotao1 luotao1 added the HappyOpenSource Pro 进阶版快乐开源活动,更具挑战性的任务 label Nov 27, 2024
op->attribute<pir::BoolAttribute>(kCanRunTrtAttr).data()) {
return false;
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

padding_algorithm没检查

@@ -374,6 +375,42 @@ class DepthwiseConv2dTransposeOpPattern
}
};

class Conv3dTransposeOpPattern
: public pir::OpRewritePattern<paddle::dialect::Conv3dTransposeOp> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

你写的到底是conv3d还是conv3d_transpose

if (op->HasAttribute("padding_algorithm")) {
auto padding_algorithm =
op->attribute<pir::StrAttribute>("padding_algorithm").AsString();
if (padding_algorithm == "SAME") {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个检查不对,conv3d_transpose且是same且不是动态shape才不让进trt

VLOG(3) << "In conv3d, paddings size must be less than or equal to 3";
return false;
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

看的仔细点,dilations属性没检查

dilation = paddle_op.attrs().get("dilations", [1, 1, 1])
groups = paddle_op.attrs().get("groups", 1)

if has_dynamic_shape(input_shape):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个不用检查,一定是动态shape


output_padding = paddle_op.attrs().get("output_padding", [0, 0, 0])
padding_algorithm = paddle_op.attrs().get("padding_algorithm", "EXPLICIT")
if padding_algorithm == "VALID":
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这一句哪来的,我怎么没在旧ir里找到?

nv_dilations = trt.Dims3(dilation[0], dilation[1], dilation[2])
nv_strides = trt.Dims3(stride[0], stride[1], stride[2])

pre_paddings = [0, 0, 0]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pre_paddings应该是trt.Dims(paddings...吧)

pre_paddings = [0, 0, 0]
post_paddings = [0, 0, 0]

if len(paddings) == 3:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这段代码在旧ir下没找到,怎么写的?

post_paddings[0] = paddings[0]
post_paddings[1] = paddings[1]
post_paddings[2] = paddings[2]
elif len(paddings) == 6:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

同上

@ZHOU05030 ZHOU05030 changed the title 【BUPT】【Paddle TensorRT No.18】Add pd_op.conv3d converter 【BUPT】【Paddle TensorRT No.18】Add pd_op.conv3d and pd_op.conv3d_transpose converter Dec 9, 2024
}
}

if (op->HasAttribute("output_padding")) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这一块可以去掉了

if (op->HasAttribute("padding_algorithm")) {
auto padding_algorithm =
op->attribute<pir::StrAttribute>("padding_algorithm").AsString();
if (padding_algorithm == "SAME") {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里不对,如果是conv3d_transpose且是same且不是动态shape,则return false

if paddle_op.name() == "pd_op.conv3d":
input_tensor, filter = inputs
elif paddle_op.name() == "pd_op.conv3d_transpose":
if len(inputs) == 3:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里哪来的输入长度为3?

input_tensor, filter, output_size = inputs
elif len(inputs) == 2:
input_tensor, filter = inputs
output_size = None
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

哪来的output_size?

return conv(x)


class TestConv3dTRTPattern(TensorRTBaseTest):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

单测太少了,再测试下padding_algorithm为SAME,为valid和EXPLICIT,把conv3d_transpose补上吧,

Copy link

paddle-ci-bot bot commented Dec 26, 2024

Sorry to inform you that 4e377ec's CIs have passed for more than 7 days. To prevent PR conflicts, you need to re-run all CIs manually.

@luotao1 luotao1 closed this Jan 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributor External developers HappyOpenSource Pro 进阶版快乐开源活动,更具挑战性的任务
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants