[Dy2stat] Add Support for paddle.grad#33110
Merged
zhhsplendid merged 12 commits intoPaddlePaddle:developfrom Jun 4, 2021
Merged
[Dy2stat] Add Support for paddle.grad#33110zhhsplendid merged 12 commits intoPaddlePaddle:developfrom
zhhsplendid merged 12 commits intoPaddlePaddle:developfrom
Conversation
|
Thanks for your contribution! |
|
Sorry to inform you that 8b48d9b's CIs have passed for more than 7 days. To prevent PR conflicts, you need to re-run all CIs manually. |
Aurelius84
reviewed
Jun 4, 2021
| def forward(self, inputs): | ||
| in_vars, out_vars, tmp_scope_vec = self._prepare(inputs) | ||
|
|
||
| double_grads = self._get_double_grads(self._origin_main_program) |
Contributor
There was a problem hiding this comment.
这里的main_program是固定的,所以 double_grads 是否只需要 core.VarBase 创建一次就可以了,每个batch 直接复用就好了?
因为这个 get_double_grads放在forward里,调用频率会很高,grads_var的name解析等都是可以只做一次的。
python/paddle/fluid/dygraph/io.py
Outdated
| cur_block = program_desc.block(b_idx) | ||
| for var_idx, var in enumerate(cur_block.all_vars()): | ||
| name_old = var.name() | ||
| is_double_grad_var = "GRAD" in name_old |
| value=[1], | ||
| name='Fake_var', | ||
| place=framework._current_expected_place()) | ||
| ] |
Contributor
There was a problem hiding this comment.
ddout在 Maker 里标记的是 AsDispensable,如果为空,这里是不是不用 fake 了?
Member
Author
Aurelius84
approved these changes
Jun 4, 2021
Contributor
Aurelius84
left a comment
There was a problem hiding this comment.
LGTM with my knowledge
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

PR types
New features
PR changes
APIs
Describe
This PR made these changes to support double grad:
paddle.gradtopaddle.static.gradientsto support double grad for dy2stat.DOutto support double grad variables inrun_program_opjit.save/load