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

Extend vjp_interface_gen_op_list #57279

Merged
merged 3 commits into from
Sep 14, 2023

Conversation

changeyoung98
Copy link
Contributor

@changeyoung98 changeyoung98 commented Sep 13, 2023

PR types

Others

PR changes

Others

Description

pcard-67164
Extend vjp_interface_gen_op_list and keep the list equal to list VJPS in gen.py

  • 添加对于含有ArrayAttribute类型算子的支持,采用与build中类似的逻辑,获取array的长度然后依次获取元素加入至vector中。
OP_VJP_ATTRIBUTE_ARRAY_TEMPLATE = """
    {attr_type} {attr_name};
    for (size_t i = 0; i < op->attribute("{attr_name}").dyn_cast<pir::ArrayAttribute>().size(); i++) {{
        {attr_name}.push_back(op->attribute("{attr_name}").dyn_cast<pir::ArrayAttribute>().at(i).dyn_cast<{inner_type}>().{func}());
    }}"""
  • 由于mutable类型的属性构建方式与输入输出一致,因此需要放置在在参数列表前列,修改_vjp函数参数列表的构建方式。

@paddle-bot
Copy link

paddle-bot bot commented Sep 13, 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.

Copy link
Contributor

@xiaoguoguo626807 xiaoguoguo626807 left a comment

Choose a reason for hiding this comment

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

LGTM

@changeyoung98 changeyoung98 merged commit 0ade0f8 into PaddlePaddle:develop Sep 14, 2023
@changeyoung98 changeyoung98 deleted the czy-gen branch September 20, 2023 03:01
danleifeng pushed a commit to danleifeng/Paddle that referenced this pull request Nov 14, 2023
* extend vjp gen list

* fix ArrayAttribute vjp gen
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.

2 participants