Skip to content

Conversation

@crazyxiaoxi
Copy link
Contributor

@crazyxiaoxi crazyxiaoxi commented Jul 26, 2024

PR Category

CINN

PR Types

improvements

Description

添加box_clip算子符号推导接口
test/legacy_test/test_box_clip_op.py 已经包含 check_test_output

@paddle-bot
Copy link

paddle-bot bot commented Jul 26, 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 Jul 26, 2024
@luotao1 luotao1 added the HappyOpenSource Pro 进阶版快乐开源活动,更具挑战性的任务 label Jul 26, 2024
@crazyxiaoxi
Copy link
Contributor Author

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(
Copy link
Contributor

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(
Copy link
Contributor

Choose a reason for hiding this comment

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

同上

Copy link
Contributor Author

@crazyxiaoxi crazyxiaoxi Aug 5, 2024

Choose a reason for hiding this comment

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

截屏2024-08-05 23 35 41 infermeta里面只有和非零数的比较,没有两个shape之间的比较没法实现...把这部分代码给删除了

Copy link
Contributor

Choose a reason for hiding this comment

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

可以实现的,用常量数据创建一个DimExpr,然后添加约束

@crazyxiaoxi crazyxiaoxi closed this Aug 6, 2024
@crazyxiaoxi crazyxiaoxi reopened this Aug 6, 2024
@crazyxiaoxi crazyxiaoxi changed the title 【Infer Symbolic Shape BUAA No.10】Add box_clip op [BUAA]【Infer Symbolic Shape No.10】Add box_clip op Aug 6, 2024
@crazyxiaoxi crazyxiaoxi reopened this Aug 6, 2024
infer_context->GetShapeOrDataForValue(op->operand_source(1));

// Check rank and dimensions of input tensors
if (op->attribute<pir::BoolAttribute>("is_runtime").data()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

yaml定义中没有这个attribute吧

Copy link
Contributor Author

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();
Copy link
Contributor

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

Copy link
Contributor Author

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};
Copy link
Contributor

Choose a reason for hiding this comment

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

const auto &

Copy link
Contributor Author

Choose a reason for hiding this comment

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

已修改

@crazyxiaoxi
Copy link
Contributor Author

test_box_clip_op.py中已包含OpTest单测,本地测试通过
截屏2024-08-09 11 10 10

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.

3 participants