[WIP] Add tests for R to C cases#44744
Closed
anjali411 wants to merge 9 commits intogh/anjali411/55/basefrom
Closed
[WIP] Add tests for R to C cases#44744anjali411 wants to merge 9 commits intogh/anjali411/55/basefrom
anjali411 wants to merge 9 commits intogh/anjali411/55/basefrom
Conversation
[ghstack-poisoned]
This was referenced Sep 15, 2020
💊 CI failures summary and remediationsAs of commit 7ee82fc (more details on the Dr. CI page): Commit 7ee82fc was recently pushed. Waiting for builds... This comment was automatically generated by Dr. CI (expand for details).Follow this link to opt-out of these comments for your Pull Requests.Please report bugs/suggestions on the GitHub issue tracker or post in the (internal) Dr. CI Users group. This comment has been revised 47 times. |
[ghstack-poisoned]
anjali411
added a commit
that referenced
this pull request
Sep 16, 2020
This PR adds gradcheck for complex. The logic used for complex gradcheck is described in Section 3.5.3 here: https://arxiv.org/pdf/1701.00392.pdf More concretely, this PR introduces the following changes: 1. Updates get_numerical_jacobian to take as input a scalar value for vector (v). Adds gradcheck logic for C -> C, C-> R, R -> C. For R -> C functions, only the real value of gradient is propagated. 2. Adds backward definition for `torch.complex` and also adds a test to verify the definition added. 3. Updates backward for `mul`, `sin`, `cos`, `sinh`, `cosh`. 4. Adds tests for all `torch.real`, `torch.imag`, `torch.view_as_real`, `torch.view_as_complex`, `torch.conj`. Follow up tasks: - [ ] Add more thorough tests for R -> C cases. Specifically, add R->C test variants for functions. for e.g., `torch.mul(complex_tensor, real_tensor)` (#44744 ) - [ ] Add back commented test in `common_methods_invocation.py`. ( #43208 ) - [ ] Add more special case checking for complex gradcheck to make debugging easier. - [ ] Update complex autograd note. - [ ] disable complex autograd for operators not tested for complex. - [ ] Re-enable tests in `test_ops.py` for complex dtype. ( #43208 ) - [ ] Re-enable `TestGradCheckOverride.test_gradcheck` cc. @hameerabbasi Differential Revision: [D23655088](https://our.internmc.facebook.com/intern/diff/D23655088) [ghstack-poisoned]
anjali411
added a commit
that referenced
this pull request
Sep 16, 2020
This PR adds gradcheck for complex. The logic used for complex gradcheck is described in Section 3.5.3 here: https://arxiv.org/pdf/1701.00392.pdf More concretely, this PR introduces the following changes: 1. Updates get_numerical_jacobian to take as input a scalar value for vector (v). Adds gradcheck logic for C -> C, C-> R, R -> C. For R -> C functions, only the real value of gradient is propagated. 2. Adds backward definition for `torch.complex` and also adds a test to verify the definition added. 3. Updates backward for `mul`, `sin`, `cos`, `sinh`, `cosh`. 4. Adds tests for all `torch.real`, `torch.imag`, `torch.view_as_real`, `torch.view_as_complex`, `torch.conj`. Follow up tasks: - [ ] Add more thorough tests for R -> C cases. Specifically, add R->C test variants for functions. for e.g., `torch.mul(complex_tensor, real_tensor)` (#44744 ) - [ ] Add back commented test in `common_methods_invocation.py`. ( #43208 ) - [ ] Add more special case checking for complex gradcheck to make debugging easier. - [ ] Update complex autograd note. - [ ] disable complex autograd for operators not tested for complex. - [ ] Re-enable tests in `test_ops.py` for complex dtype. ( #43208 ) - [ ] Re-enable `TestGradCheckOverride.test_gradcheck` cc. @hameerabbasi Differential Revision: [D23655088](https://our.internmc.facebook.com/intern/diff/D23655088) [ghstack-poisoned]
[ghstack-poisoned]
anjali411
added a commit
that referenced
this pull request
Sep 16, 2020
This PR adds gradcheck for complex. The logic used for complex gradcheck is described in Section 3.5.3 here: https://arxiv.org/pdf/1701.00392.pdf More concretely, this PR introduces the following changes: 1. Updates get_numerical_jacobian to take as input a scalar value for vector (v). Adds gradcheck logic for C -> C, C-> R, R -> C. For R -> C functions, only the real value of gradient is propagated. 2. Adds backward definition for `torch.complex` and also adds a test to verify the definition added. 3. Updates backward for `mul`, `sin`, `cos`, `sinh`, `cosh`. 4. Adds tests for all `torch.real`, `torch.imag`, `torch.view_as_real`, `torch.view_as_complex`, `torch.conj`. Follow up tasks: - [ ] Add more thorough tests for R -> C cases. Specifically, add R->C test variants for functions. for e.g., `torch.mul(complex_tensor, real_tensor)` (#44744 ) - [ ] Add back commented test in `common_methods_invocation.py`. ( #43208 ) - [ ] Add more special case checking for complex gradcheck to make debugging easier. - [ ] Update complex autograd note. - [ ] disable complex autograd for operators not tested for complex. - [ ] Re-enable tests in `test_ops.py` for complex dtype. ( #43208 ) - [ ] Re-enable `TestGradCheckOverride.test_gradcheck` cc. @hameerabbasi Differential Revision: [D23655088](https://our.internmc.facebook.com/intern/diff/D23655088) [ghstack-poisoned]
anjali411
added a commit
that referenced
this pull request
Sep 16, 2020
This PR adds gradcheck for complex. The logic used for complex gradcheck is described in Section 3.5.3 here: https://arxiv.org/pdf/1701.00392.pdf More concretely, this PR introduces the following changes: 1. Updates get_numerical_jacobian to take as input a scalar value for vector (v). Adds gradcheck logic for C -> C, C-> R, R -> C. For R -> C functions, only the real value of gradient is propagated. 2. Adds backward definition for `torch.complex` and also adds a test to verify the definition added. 3. Updates backward for `mul`, `sin`, `cos`, `sinh`, `cosh`. 4. Adds tests for all `torch.real`, `torch.imag`, `torch.view_as_real`, `torch.view_as_complex`, `torch.conj`. Follow up tasks: - [ ] Add more thorough tests for R -> C cases. Specifically, add R->C test variants for functions. for e.g., `torch.mul(complex_tensor, real_tensor)` (#44744 ) - [ ] Add back commented test in `common_methods_invocation.py`. ( #43208 ) - [ ] Add more special case checking for complex gradcheck to make debugging easier. - [ ] Update complex autograd note. - [ ] disable complex autograd for operators not tested for complex. - [ ] Re-enable tests in `test_ops.py` for complex dtype. ( #43208 ) - [ ] Re-enable `TestGradCheckOverride.test_gradcheck` cc. @hameerabbasi Differential Revision: [D23655088](https://our.internmc.facebook.com/intern/diff/D23655088) [ghstack-poisoned]
[ghstack-poisoned]
anjali411
added a commit
that referenced
this pull request
Sep 21, 2020
…inition for torch.vdot" TODO: Add R -> C tests in #44744 (blocked on some JIT changes) [ghstack-poisoned]
anjali411
added a commit
that referenced
this pull request
Sep 28, 2020
…inition for torch.vdot" TODO: Add R -> C tests in #44744 (blocked on some JIT changes) [ghstack-poisoned]
anjali411
added a commit
that referenced
this pull request
Sep 29, 2020
…inition for torch.vdot" TODO: Add R -> C tests in #44744 (blocked on some JIT changes) Differential Revision: [D23975361](https://our.internmc.facebook.com/intern/diff/D23975361) [ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
laurentdupin
pushed a commit
to laurentdupin/pytorch
that referenced
this pull request
Apr 24, 2026
… torch.vdot (pytorch#45074) Summary: Pull Request resolved: pytorch#45074 TODO: Add R -> C tests in pytorch#44744 (blocked on some JIT changes) Test Plan: Imported from OSS Reviewed By: gchanan Differential Revision: D23975361 Pulled By: anjali411 fbshipit-source-id: 3512bd2962b588a198bc317673bd18cc96ac823f
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.
Stack from ghstack: