[Comp] Add view_shape_double_grad for eager mode#76667
Merged
HydrogenSulfate merged 4 commits intoPaddlePaddle:developfrom Dec 2, 2025
Merged
[Comp] Add view_shape_double_grad for eager mode#76667HydrogenSulfate merged 4 commits intoPaddlePaddle:developfrom
view_shape_double_grad for eager mode#76667HydrogenSulfate merged 4 commits intoPaddlePaddle:developfrom
Conversation
|
你的PR提交成功,感谢你对开源项目的贡献! |
view_shape_double_grad for eager mode
zyfncg
reviewed
Nov 28, 2025
zyfncg
approved these changes
Dec 1, 2025
xiaoguoguo626807
approved these changes
Dec 1, 2025
Contributor
|
approve for Distribute-stable-test |
11e7dc0
into
PaddlePaddle:develop
268 of 294 checks passed
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 Category
Execute Infrastructure
PR Types
Bug fixes
Description
Pcard-75624
由于strided机制的引入,
view_reshape反向不能简单复用前向view,而是需要插入一些转连续的操作,因此 revert #71086 的修改,并通过添加view_shape_double_grad来支持view的高阶微分计算 @Eddie-Wang1120This pull request introduces support for the
view_shapeoperation and its gradients (first and second order) throughout the PaddlePaddle codebase. The changes add the forward op, its backward (gradient), and double backward (second derivative) implementations, update relevant op lists and configuration files, and add corresponding test coverage. The most important changes are grouped below by theme.Operator and Gradient Implementation:
view_shapeoperator to the ops registry with its arguments, output, inference meta, kernel, and backward mapping inops.yaml. (paddle/phi/ops/yaml/ops.yaml)view_shape_double_gradfunction template in C++ for the second-order gradient of theview_shapeop. (paddle/fluid/prim/api/composite_backward/composite_double_backward_api.h)Operator Registration and Compatibility:
view_shapeop and its gradients (view_shape_grad,view_shape_double_grad) in the op compatibility YAML. (paddle/phi/ops/yaml/op_compat.yaml)view_shape_gradop to the VJP interface blacklist to prevent automatic VJP generation. (paddle/fluid/pir/dialect/op_generator/vjp_interface_black_list.py)Backward and Double Backward Configuration:
view_shape_grad(first-order gradient) andview_shape_double_grad(second-order gradient) in the backward op configuration, specifying their forward links, arguments, outputs, meta inference, and composite/implementation functions. (paddle/phi/ops/yaml/backward.yaml)view_shapeand its gradient, as they are now consistently defined. (paddle/phi/ops/yaml/inconsistent/dygraph_ops.yaml,paddle/phi/ops/yaml/inconsistent/dygraph_backward.yaml) [1] [2]Code Generation and Testing:
view_shape_double_gradto the list of double grad ops in the eager code generator and cleaned up related code logic. (paddle/fluid/eager/auto_code_generator/generator/eager_gen.py) [1] [2]call_view8) in the stride tests to ensure coverage for the new op. (test/legacy_test/test_stride.py)