-
Notifications
You must be signed in to change notification settings - Fork 5.9k
[BUAA]【Infer Symbolic Shape No.10】Add box_clip op #66629
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
Conversation
|
你的PR提交成功,感谢你对开源项目的贡献! |
|
test_box_clip_op.py中已包含OpTest单测,self.check_output() 确认使用,申请approve流水线 |
| common::errors::InvalidArgument("The rank of Input(input) in BoxClipOp " | ||
| "must be 4. But received rank = %d", | ||
| input_dims.size())); | ||
| PADDLE_ENFORCE_EQ( |
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.
DimExpr的约束应该用 Addequalcstr()
| "The rank of Input(im_info) in BoxClipOp must be 2. " | ||
| "But received rank = %d", | ||
| im_info_dims.size())); | ||
| PADDLE_ENFORCE_EQ( |
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.
同上
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.
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.
可以实现的,用常量数据创建一个DimExpr,然后添加约束
69c72a5 to
c862a90
Compare
c862a90 to
591ae2e
Compare
| infer_context->GetShapeOrDataForValue(op->operand_source(1)); | ||
|
|
||
| // Check rank and dimensions of input tensors | ||
| if (op->attribute<pir::BoolAttribute>("is_runtime").data()) { |
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.
yaml定义中没有这个attribute吧
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.
刘旭东也遇到了类似的问题,把这个is_runtime判断给移除了
| // Check rank and dimensions of input tensors | ||
| if (op->attribute<pir::BoolAttribute>("is_runtime").data()) { | ||
| const auto &input_dims = input_shape.shape(); | ||
| const auto &im_info_dims = im_info_shape.shape(); |
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.
命名不规范,示例:input_shape、im_info_shape
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.
已修改
| if (op->attribute<pir::BoolAttribute>("is_runtime").data()) { | ||
| const auto &input_dims = input_shape.shape(); | ||
| const auto &im_info_dims = im_info_shape.shape(); | ||
| const auto three = symbol::DimExpr{3}; |
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.
const auto &
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.
已修改


PR Category
CINN
PR Types
improvements
Description
添加box_clip算子符号推导接口
test/legacy_test/test_box_clip_op.py 已经包含 check_test_output