[ Dy2Static ] fix bugs in prepare_gradient_aggregation #45268
Merged
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
Others
PR changes
Others
Describe
修复了一些段错误的问题,之前的prepare_gradient_aggregation没有考虑到动转静会跳过append backward中插入的一些成对的shape + fill_constant的Op,因此会找到这类fill constant,所以出现段错误,具体的在RunProgramGradKernel中。
TODO:直接在Program中进行删除,减少这种表示和执行的差异(trick方法),可以减少系统的复杂度。希望Python端最后执行的Program是啥样,跑的就是啥样,C++端进行选择跳过容易造成后续人员的误解。