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

[static code gen]add error msg in composite maker code gen #51211

Merged
merged 11 commits into from
Mar 10, 2023

Conversation

Charles-hit
Copy link
Contributor

@Charles-hit Charles-hit commented Mar 5, 2023

PR types

New features

PR changes

Others

Describe

Pcard-66975
由于组合算子不支持Tensor attribute,因此在composite grad maker中为组合算子使用到Tensor attribute添加报错.
image

@paddle-bot
Copy link

paddle-bot bot commented Mar 5, 2023

你的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
Copy link

paddle-bot bot commented Mar 5, 2023

❌ The PR is not created using PR's template. You can refer to this Demo.
Please use PR's template, it helps save our maintainers' time so that more developers get helped.

@Charles-hit Charles-hit closed this Mar 9, 2023
@Charles-hit Charles-hit reopened this Mar 9, 2023
@@ -691,6 +692,29 @@ class {{op_name | to_composite_grad_opmaker_name}} : public prim::CompositeGradO
{%- endfor %}
{%- endmacro %}

construct_composite_tensor_attr(attrs, fluid_attrs, attr_dict)
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

Choose a reason for hiding this comment

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

已经删除

{% for i in range(attrs_length) %}
{% if "tensor_name" in attr_dict[attrs[i]] %}
auto {{'tensor_' + attrs[i]}} = this->GetOptionalSingleForwardInput("{{attr_dict[attrs[i]]['tensor_name']}}");
if ({{'tensor_' + attrs[i]}}.is_initialized()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

能否直接使用if进行判断,is_initialized和tensor成员函数名相同了,使用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.

done

Comment on lines 702 to 704
PADDLE_THROW(platform::errors::Unimplemented(
"We don't support dynamic tensor attribute for {{op_name}} composite"
"for now. "));
Copy link
Contributor

Choose a reason for hiding this comment

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

异常信息中建议包含attrbitue name信息

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Copy link
Contributor

@JiabinYang JiabinYang left a comment

Choose a reason for hiding this comment

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

LGTM

@Charles-hit Charles-hit merged commit 07d8770 into PaddlePaddle:develop Mar 10, 2023
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