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

【SCU】【Paddle TensorRT No.48】Add pd_op.pad converter #69673

Draft
wants to merge 8 commits into
base: develop
Choose a base branch
from

Conversation

PolaKuma
Copy link
Contributor

PR Category

User Experience

PR Types

New features

Description

新增了 pd_op.pad Marker和Converter

Copy link

paddle-bot bot commented Nov 25, 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 25, 2024
@PolaKuma PolaKuma changed the title 【SCU】【Paddle TensorRT No.11、12、65】Add pd_op.pad converter 【SCU】【Paddle TensorRT No.48】Add pd_op.pad converter Nov 25, 2024
@luotao1 luotao1 added the HappyOpenSource Pro 进阶版快乐开源活动,更具挑战性的任务 label Nov 25, 2024
}

// Check for the existence of the attributes pad_value and paddings
if (!op->HasAttribute("pad_value") || !op->HasAttribute("paddings")) {
Copy link
Contributor

Choose a reason for hiding this comment

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

paddings是属性,pad_value是输入

return false;
}
for (int i = 0; i < pad_size - 4; ++i) {
if (paddings[i].dyn_cast<pir::Int64Attribute>().data() != 0) {
Copy link
Contributor

Choose a reason for hiding this comment

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

应该是int32

def setUp(self):
self.python_api = paddle.nn.functional.pad
self.api_args = {
"x": np.random.randn(1, 3, 32, 32).astype("float32"),
Copy link
Contributor

Choose a reason for hiding this comment

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

测一下int64的情况,如果支持的话

}

// Check for the existence of the attributes pad_value and paddings
if (!op->HasAttribute("pad_value") || !op->HasAttribute("paddings")) {
Copy link
Contributor

Choose a reason for hiding this comment

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

可以参考pd_op.h文件里PadOp定义的代码,这里构建算子的时候,pad_value可以传入value(对应旧IR的输入)或者float(对应原来旧IR下的attribute),这种场景下不管是value还是float,进入到PIR内都会变成输入operands,所以你需要判断pad_value是否是float传入的,这才能对应起来原来旧IR下那部分attribute判断逻辑,可以使用这个pir::GetDefiningOpForInput(op, 1)->isa<paddle::dialect::FullOp>()来判断是否是属性pad_value,详情使用可以进一步参考trt_op_marker_pass.cc里的其他代码

Copy link

paddle-ci-bot bot commented Dec 20, 2024

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

@PolaKuma PolaKuma marked this pull request as draft December 31, 2024 07:20
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