-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
base: develop
Are you sure you want to change the base?
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
pd_op.pad
converterpd_op.pad
converter
} | ||
|
||
// Check for the existence of the attributes pad_value and paddings | ||
if (!op->HasAttribute("pad_value") || !op->HasAttribute("paddings")) { |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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"), |
There was a problem hiding this comment.
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")) { |
There was a problem hiding this comment.
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里的其他代码
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. |
PR Category
User Experience
PR Types
New features
Description
新增了
pd_op.pad
Marker和Converter