Skip to content

[CINN]optimze cinn slice infer symbolic #67803

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

Merged

Conversation

phlrain
Copy link
Collaborator

@phlrain phlrain commented Aug 29, 2024

PR Category

CINN

PR Types

Others

Description

pcard-76996

优化slice的 符号推导逻辑
对于 a[:200], a[:S0] 这种写法,需要考虑 dim 和 end 存在的情况,有符号的时候,要取最小值

TODO:

  1. 需要考虑end 是否存在负数的情况

Copy link

paddle-bot bot commented Aug 29, 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.

@phlrain phlrain changed the title optimze cinn slice infer symbolic [CINN]optimze cinn slice infer symbolic Aug 30, 2024
slice_dims.at(axis) = ends.at(i) - starts.at(i);
int64_t axis = axes[i];
slice_dims[axis] = ends[i] - starts[i];
if (!in_dims[axis].isa<int64_t>() || !ends[i].isa<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.

这里如果都为int类型,是不也需要取个最小值?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

如果都是int,在CheckAndUpdateSliceAttrs 已经把ends[i] 更新为 in_dim[axes]了

Copy link
Contributor

Choose a reason for hiding this comment

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

这里如果都为int类型,是不也需要取个最小值?

这种情况放在CheckAndUpdateSliceAttrs()中处理了

Copy link
Contributor

Choose a reason for hiding this comment

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

那这里的end取最小值是不也最好统一放在CheckAndUpdateSliceAttrs里面?

@phlrain phlrain merged commit e0f3072 into PaddlePaddle:develop Aug 30, 2024
29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants