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

【Infer Symbolic Shape No.47】【BUAA】 Add frame op #67886

Closed

Conversation

MufanColin
Copy link
Contributor

PR Category

CINN

PR Types

Improvements

Description

添加 frame 算子符号推导接口。

Copy link

paddle-bot bot commented Aug 31, 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 Aug 31, 2024
@luotao1 luotao1 added the HappyOpenSource Pro 进阶版快乐开源活动,更具挑战性的任务 label Sep 2, 2024

std::vector<symbol::DimExpr> output_shape;
symbol::DimExpr n_frames;
symbol::DimExpr frame_length;
Copy link
Contributor

Choose a reason for hiding this comment

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

frame_length 应该需要从attribute里面取吧

end_axis = x_rank - 2;
}

PADDLE_ENFORCE_LE(static_cast<int>(frame_length.Get<std::int64_t>()),
Copy link
Contributor

Choose a reason for hiding this comment

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

这个enforce缺少一个前置判断,判断x_shape中的DimExpr是不是全都是int类型

"Attribute(frame_length) of FrameOp should be less "
"equal than sequence length, but got (%s) > (%s).",
static_cast<int>(frame_length.Get<std::int64_t>()),
static_cast<int>(seq_length.Get<std::int64_t>())));
Copy link
Contributor

Choose a reason for hiding this comment

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

frame_length这里不需要cast了,是int类型的attribute

output_shape.push_back(x_shape[i]);
}

if (seq_length == -1) {
Copy link
Contributor

Choose a reason for hiding this comment

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

这里应该是 !seq_length.isa<int64_t>(),再理解一下meta和符号推导是怎么表示动态维度的

}

if (seq_length == -1) {
n_frames = -1;
Copy link
Contributor

Choose a reason for hiding this comment

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

这里该使用新符号了

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