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

[Dy2static] Auto Remove Step Scope while GradRunProgramNode GCed. #51411

Merged
merged 3 commits into from
Mar 20, 2023

Conversation

2742195759
Copy link
Contributor

@2742195759 2742195759 commented Mar 9, 2023

PR types

Performance optimization

PR changes

Others

Describe

PCard-66972
用户可以支持如下的操作,而不用显示的切换到eval模式下了:

import paddle
import time
def func(x):
    return  x * x

x = paddle.rand((1, 1000, 1000, 1000))
x.stop_gradient = True
func = paddle.jit.to_static(func)
for i in range(20):
    time.sleep(3)
    print("Step ", i)
    loss = func(x) # <--  mult-forward, but don't call backward.
    del loss

@paddle-bot
Copy link

paddle-bot bot commented Mar 9, 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 9, 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.

@2742195759 2742195759 changed the title [Dy2static] Auto [Dy2static] Auto Remove Step Scope while GradRunProgramNode is GC. Mar 9, 2023
@2742195759 2742195759 changed the title [Dy2static] Auto Remove Step Scope while GradRunProgramNode is GC. [Dy2static] Auto Remove Step Scope while GradRunProgramNode GCed. Mar 9, 2023
Aurelius84
Aurelius84 previously approved these changes Mar 9, 2023
Copy link
Contributor

@Aurelius84 Aurelius84 left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@Aurelius84 Aurelius84 left a comment

Choose a reason for hiding this comment

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

LGTM

@2742195759 2742195759 merged commit 4f32aae into PaddlePaddle:develop Mar 20, 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.

2 participants