Skip to content

Conversation

@0x45f
Copy link
Contributor

@0x45f 0x45f commented Nov 19, 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模式。

@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

@Aurelius84 Aurelius84 merged commit eb60239 into PaddlePaddle:develop Nov 22, 2021
0x45f added a commit to 0x45f/Paddle that referenced this pull request Nov 22, 2021
…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()
lanxianghit pushed a commit that referenced this pull request Nov 23, 2021
…to decorate a function (#37383) (#37432) 本PR之前使用@to_static装饰一个单独的function时,对于生成的Program无法切换train/eval模式,只能运行在train模式下。这也就导致动转静后用户多次调用function显存会一直增长。 本PR之后,使用@to_static装饰一个单独的function时,可以通过function.train()或者function.eval()的方式来切换train/eval模式。
@0x45f 0x45f deleted the dy2stat_eval/train branch December 24, 2021 04:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants