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

[NewIR] No.14 Migrate paddle.pow into pir #57297

Merged
merged 5 commits into from
Sep 18, 2023

Conversation

gouzil
Copy link
Member

@gouzil gouzil commented Sep 13, 2023

PR types

Others

PR changes

Others

Description

相关链接:

@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.

@paddle-bot paddle-bot bot added the contributor External developers label Sep 13, 2023
@gouzil
Copy link
Member Author

gouzil commented Sep 14, 2023

求助一下研发大哥,开启 new ir 的话传入参数 y 和 x 会变成<paddle.base.libpaddle.ir.OpResult object at 0x121af2bf0>

不开启 new ir 是正常的Tensor, 是哪里需要转换一下嘛

@luotao1 luotao1 added the HappyOpenSource 快乐开源活动issue与PR label Sep 14, 2023
@@ -44,15 +44,17 @@ def test_check_output(self):
if hasattr(self, 'attrs'):
self.check_output(check_dygraph=False)
else:
self.check_output()
self.check_output(check_new_ir=True)
Copy link
Contributor

Choose a reason for hiding this comment

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

这里改了单测基类,可能对于复数类型导出的错误,可以以屏蔽下复数类型单测,看下单测是否能过?

@YuanRisheng
Copy link
Contributor

YuanRisheng commented Sep 15, 2023

@gouzil 这样修改:
PR里的代码:

    # in dynamic graph mode
    if in_dynamic_or_pir_mode():
        if isinstance(y, (int, float)):
            return _C_ops.pow(x, y)
        elif isinstance(y, (paddle.Tensor, Variable)):
            return _C_ops.elementwise_pow(x, y)
        else:
            raise TypeError(
                'y must be scalar or tensor type, but received: %s ' % (y.dtype)
            )

修改后:

    # in dynamic graph mode
    if in_dynamic_or_pir_mode():
        if isinstance(y, (int, float)):
            return _C_ops.pow(x, y)
        elif isinstance(y, (paddle.Tensor, Variable, paddle.ir.OpResult)):
            return _C_ops.elementwise_pow(x, y)
        else:
            raise TypeError(
                'y must be scalar , Tensor(in dygraph mode), OpResult(in pir mode) but received: %s ' % (y.dtype)
            )

@gouzil
Copy link
Member Author

gouzil commented Sep 17, 2023

@gouzil 这样修改: PR里的代码:

Done

@YuanRisheng YuanRisheng merged commit 4dd2018 into PaddlePaddle:develop Sep 18, 2023
@gouzil gouzil deleted the NewIR_pow branch September 24, 2023 14:27
Frida-a pushed a commit to Frida-a/Paddle that referenced this pull request Oct 14, 2023
* [NewIR] No.14 Migrate paddle.pow into pir

* fix

* add test

* fix
danleifeng pushed a commit to danleifeng/Paddle that referenced this pull request Nov 14, 2023
* [NewIR] No.14 Migrate paddle.pow into pir

* fix

* add test

* fix
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributor External developers HappyOpenSource 快乐开源活动issue与PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants