Skip to content

[WIP] Add tests for R to C cases#44744

Closed
anjali411 wants to merge 9 commits intogh/anjali411/55/basefrom
gh/anjali411/55/head
Closed

[WIP] Add tests for R to C cases#44744
anjali411 wants to merge 9 commits intogh/anjali411/55/basefrom
gh/anjali411/55/head

Conversation

@anjali411
Copy link
Copy Markdown
Contributor

@anjali411 anjali411 commented Sep 15, 2020

Stack from ghstack:

[ghstack-poisoned]
anjali411 added a commit that referenced this pull request Sep 15, 2020
ghstack-source-id: e7bd676
Pull Request resolved: #44744
@dr-ci
Copy link
Copy Markdown

dr-ci Bot commented Sep 15, 2020

💊 CI failures summary and remediations

As 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.

See how this bot performed.

This comment has been revised 47 times.

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]
anjali411 added a commit that referenced this pull request Sep 16, 2020
ghstack-source-id: d05084a
Pull Request resolved: #44744
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]
anjali411 added a commit that referenced this pull request Sep 16, 2020
ghstack-source-id: faf570d
Pull Request resolved: #44744
anjali411 added a commit that referenced this pull request Sep 21, 2020
ghstack-source-id: f9f3820
Pull Request resolved: #44744
@anjali411 anjali411 changed the title Add tests for R to C cases [WIP] Add tests for R to C cases Sep 21, 2020
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]
facebook-github-bot pushed a commit that referenced this pull request Sep 29, 2020
… torch.vdot (#45074)

Summary:
Pull Request resolved: #45074

TODO: Add R -> C tests in #44744 (blocked on some JIT changes)

Test Plan: Imported from OSS

Reviewed By: gchanan

Differential Revision: D23975361

Pulled By: anjali411

fbshipit-source-id: 3512bd2962b588a198bc317673bd18cc96ac823f
anjali411 added a commit that referenced this pull request Sep 30, 2020
ghstack-source-id: db961a2
Pull Request resolved: #44744
anjali411 added a commit that referenced this pull request Oct 1, 2020
ghstack-source-id: 0da17da
Pull Request resolved: #44744
anjali411 added a commit that referenced this pull request Oct 1, 2020
ghstack-source-id: e81aeeb
Pull Request resolved: #44744
@anjali411 anjali411 closed this May 13, 2021
@facebook-github-bot facebook-github-bot deleted the gh/anjali411/55/head branch June 12, 2021 14:16
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants