Skip to content

[Enhance] add retain_graph/create_graph options for jacobian and hessian #600

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

Merged

Conversation

HydrogenSulfate
Copy link
Collaborator

@HydrogenSulfate HydrogenSulfate commented Oct 25, 2023

PR types

Function optimization

PR changes

APIs

Describe

  1. ppsci.autodiff.jacobian/hessian 添加 retain_graph/create_graph 两个选项,可将 create_graph 设置为 False 以显著减少推理含有微分操作场景下的显存占用(推理时不需要进行梯度反传,因此 grad 操作不需要创建反向图,从而减少不必要的变量创建)。

…ssary GPU mem when derivatives involved in predicting progress
@paddle-bot
Copy link

paddle-bot bot commented Oct 25, 2023

Thanks for your contribution!

@HydrogenSulfate HydrogenSulfate merged commit da4f020 into PaddlePaddle:develop Oct 26, 2023
@HydrogenSulfate HydrogenSulfate deleted the fix_create_graph branch October 26, 2023 02:58
@paddle-bot paddle-bot bot removed the contributor label Nov 3, 2023
huohuohuohuohuo123 pushed a commit to huohuohuohuohuo123/PaddleScience that referenced this pull request Aug 12, 2024
…ssary GPU mem when derivatives involved in predicting progress (PaddlePaddle#600)
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