Better reshape with autograd support (#82754)#84154
Better reshape with autograd support (#82754)#84154drisspg wants to merge 1 commit intopytorch:masterfrom
Conversation
🔗 Helpful links
✅ No Failures (0 Pending)As of commit 2b2b75e (more details on the Dr. CI page): Expand to see more💚 💚 Looks good so far! There are no failures yet. 💚 💚 This comment was automatically generated by Dr. CI (expand for details).Please report bugs/suggestions to the (internal) Dr. CI Users group. |
|
This pull request was exported from Phabricator. Differential Revision: D39023822 |
|
This pull request was exported from Phabricator. Differential Revision: D39023822 |
3df38ee to
eca1360
Compare
eca1360 to
cf96a2f
Compare
|
This pull request was exported from Phabricator. Differential Revision: D39023822 |
1 similar comment
|
This pull request was exported from Phabricator. Differential Revision: D39023822 |
cf96a2f to
13e574d
Compare
|
This pull request was exported from Phabricator. Differential Revision: D39023822 |
13e574d to
a746163
Compare
albanD
left a comment
There was a problem hiding this comment.
I want to look into the view logic in more details. But this should be ok to land for now.
|
This pull request was exported from Phabricator. Differential Revision: D39023822 |
a746163 to
e2d7f7f
Compare
|
This pull request was exported from Phabricator. Differential Revision: D39023822 |
e2d7f7f to
c98f7da
Compare
Summary: Pull Request resolved: pytorch#84154 Previous reshape [https://github.com/pytorch/pytorch/issues/80981](https://github.com/pytorch/pytorch/pull/80981) is ok for forward, but needs improvement for backward: need to handle "sometimes view sometimes copy" behavior. This pull request fixes it by: 1. add a new alias dispatch key `CompositeImplicitAutogradNestedTensor`, which ideally would work as nested-tensor version of `CompositeImplicitAutograd` 2. register `reshape_nested` to `reshape` by `CompositeImplicitAutogradNestedTensor` Side changes: * add contiguous memory format support to `clone_nested` * add `view_nested` * add `reshape_as_nested` Fix issue [https://github.com/pytorch/pytorch/issues/83041](https://github.com/pytorch/pytorch/issues/83041) Pull Request resolved: pytorch#82754 Test Plan: Imported from GitHub, without a `Test Plan:` line. **Static Docs Preview: executorch** |[Full Site](https://our.intern.facebook.com/intern/staticdocs/eph/D39023822/V26/executorch/)| |**Modified Pages**| **Static Docs Preview: executorch** |[Full Site](https://our.intern.facebook.com/intern/staticdocs/eph/D39023822/V17/executorch/)| |**Modified Pages**| Reviewed By: albanD, bdhirsh Differential Revision: D39023822 Pulled By: drisspg fbshipit-source-id: 87acd4f9fb61cd094fccad7801c25e2a1bfed88b
|
This pull request was exported from Phabricator. Differential Revision: D39023822 |
c98f7da to
2b2b75e
Compare
|
@pytorchbot merge -f 'Landed internally' (Initiating merge automatically since Phabricator Diff has merged, using force because this PR might not pass merge_rules.json but landed internally) |
|
@pytorchbot successfully started a merge job. Check the current status here. |
Summary: Pull Request resolved: #84154 Previous reshape [https://github.com/pytorch/pytorch/issues/80981](https://github.com/pytorch/pytorch/pull/80981) is ok for forward, but needs improvement for backward: need to handle "sometimes view sometimes copy" behavior. This pull request fixes it by: 1. add a new alias dispatch key `CompositeImplicitAutogradNestedTensor`, which ideally would work as nested-tensor version of `CompositeImplicitAutograd` 2. register `reshape_nested` to `reshape` by `CompositeImplicitAutogradNestedTensor` Side changes: * add contiguous memory format support to `clone_nested` * add `view_nested` * add `reshape_as_nested` Fix issue [https://github.com/pytorch/pytorch/issues/83041](https://github.com/pytorch/pytorch/issues/83041) Pull Request resolved: #82754 Test Plan: Imported from GitHub, without a `Test Plan:` line. **Static Docs Preview: executorch** |[Full Site](https://our.intern.facebook.com/intern/staticdocs/eph/D39023822/V27/executorch/)| |**Modified Pages**| **Static Docs Preview: executorch** |[Full Site](https://our.intern.facebook.com/intern/staticdocs/eph/D39023822/V17/executorch/)| |**Modified Pages**| Reviewed By: albanD, bdhirsh Differential Revision: D39023822 Pulled By: drisspg fbshipit-source-id: 872c81dc847d280366ef9f187f9b9bcb06aac73f
The original author is @YifanShenSZ and the original PR is: #82754
Summary:
Previous reshape https://github.com/pytorch/pytorch/issues/80981 is ok for forward, but needs improvement for backward: need to handle "sometimes view sometimes copy" behavior.
This pull request fixes it by:
CompositeImplicitAutogradNestedTensor, which ideally would work as nested-tensor version ofCompositeImplicitAutogradreshape_nestedtoreshapebyCompositeImplicitAutogradNestedTensorSide changes:
clone_nestedview_nestedreshape_as_nestedFix issue #83041
Pull Request resolved: #82754
Test Plan:
Imported from GitHub, without a
Test Plan:line.Static Docs Preview: executorch
|Full Site|
|Modified Pages|
Reviewed By: albanD
Differential Revision: D39023822
Pulled By: drisspg