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

[PIR] add python api for if #60895

Merged
merged 1 commit into from
Jan 22, 2024
Merged

Conversation

winter-wang
Copy link
Contributor

PR types

New features

PR changes

Others

Description

  1. 新增If python api。 并通过If python api 支持了之前的ConditionalBlock python api。
  2. fc支持pir 模式。
  3. If算子支持输入condition是一个tensor 数组的情形。

Other

Pcard-67164

Copy link

paddle-bot bot commented Jan 17, 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.

@winter-wang winter-wang force-pushed the ir_develop branch 4 times, most recently from 9a8ef41 to 7027952 Compare January 20, 2024 07:20
cond = cpu_cond.data<bool>()[0];
#else
PADDLE_THROW(paddle::platform::errors::PreconditionNotMet(
"This version of PaddlePaddle does NOT support GPU/XPU but got "
Copy link
Contributor

Choose a reason for hiding this comment

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

does NOT support GPU/XPU ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

这个目前是跟while的判定逻辑对齐的。

auto& cond_array = cond_var_->Get<VariableRefArray>();
cond = std::all_of(
cond_array.begin(), cond_array.end(), [](const Variable* t) {
return t->Get<phi::DenseTensor>().numel() != 0;
Copy link
Contributor

Choose a reason for hiding this comment

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

t 一定是 DenseTensor么,最好加一个检查?另外这里的判断逻辑就是要用tensor 的 numel 来判断么?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

a3475f9201270d0a14670a9a97523111
这个是复制的原始的condition_block.cc中的执行逻辑。我理解是只支持为densorTensor的情况。如果不是densorTensor, 在Getphi::DenseTensor()这句话里面会有错误提示。

@PaddlePaddle PaddlePaddle deleted a comment from zhangbo9674 Jan 22, 2024
Copy link
Contributor

@wanghuancoder wanghuancoder left a comment

Choose a reason for hiding this comment

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

LGTM

@winter-wang winter-wang merged commit 0d7bad2 into PaddlePaddle:develop Jan 22, 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.

4 participants