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

[Cherry-pick][Dy2stat]Allow users to switch eval/train mode when using @to_static to decorate a function #37432

Merged
merged 1 commit into from
Nov 23, 2021

Conversation

0x45f
Copy link
Contributor

@0x45f 0x45f commented Nov 22, 2021

PR types

Bug fixes

PR changes

Others

Describe

本PR之前使用@to_static装饰一个单独的function时,对于生成的Program无法切换train/eval模式,只能运行在train模式下。这也就导致动转静后用户多次调用function显存会一直增长。
本PR之后,使用@to_static装饰一个单独的function时,可以通过function.train()或者function.eval()的方式来切换train/eval模式。

…to decorate a function (PaddlePaddle#37383)

* Allow users to switch eval/train mode when using @to_static to decorate a function

* refine code for train() and eval()
@paddle-bot-old
Copy link

Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

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

@lanxianghit lanxianghit merged commit eed736d into PaddlePaddle:release/2.2 Nov 23, 2021
@0x45f 0x45f deleted the pick_dy2stat_eval/train branch December 24, 2021 04:49
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