-
Notifications
You must be signed in to change notification settings - Fork 22.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add neg bit #56058
Add neg bit #56058
Conversation
[ghstack-poisoned]
💊 CI failures summary and remediationsAs of commit 9df93ff (more details on the Dr. CI page and at hud.pytorch.org/pr/56058):
🕵️ 2 new failures recognized by patternsThe following CI failures do not appear to be due to upstream breakages: pytorch_linux_xenial_cuda11_1_cudnn8_py3_gcc7_build (1/2)Step: "Build" (full log | diagnosis details | 🔁 rerun)
|
ghstack-source-id: 113de6e3ce6534aa134da5ab61cc095e72bc804f Pull Request resolved: #56058
[ghstack-poisoned]
[ghstack-poisoned]
ghstack-source-id: d778447171e67dbac31a3a233452a4ef2fd9361e Pull Request resolved: #56058
[ghstack-poisoned]
[ghstack-poisoned]
ghstack-source-id: 9a8ccf2c1a7a675853e0edaa2fa0c6c77fc03231 Pull Request resolved: #56058
[ghstack-poisoned]
ghstack-source-id: 6514659a16e66a9baa55f7a03e5c0a901e252f2d Pull Request resolved: #56058
[ghstack-poisoned]
ghstack-source-id: 005f9e256a574f32eadb2b465962e9395a58745f Pull Request resolved: #56058
[ghstack-poisoned]
ghstack-source-id: 893a1949f88a4d23cbbbedae26ecc10c3d926a56 Pull Request resolved: #56058
[ghstack-poisoned]
ghstack-source-id: 4551a588df0f7de5e2bce8e7e3e79c0fc48812a2 Pull Request resolved: #56058
[ghstack-poisoned]
[ghstack-poisoned]
TODO: 1. remove view_as_real_physical 2. reuse ConjugateFallback code bc breaking: sparse_tensor.conj().imag doesn't work anymore. Differential Revision: [](https://our.internmc.facebook.com/intern/diff/) [ghstack-poisoned]
User facing changes: 1. Adds a negative bit and corresponding new API (`is_neg()`,`resolve_neg()`) 2. `tensor.conj().imag` now returns a floating point tensor with neg bit set to 1 instead of a tensor with no notion of negative bit. Note that imag is still a view and all the view properties still hold for imag. Non user facing changes: 1. Added a new Negative dispatch key and a backend fallback to handle it 2. Updated copy kernel to handle negative bit 3. Merged conjugate and negative bit fallback kernel 4. fixed #60478 (caused due to #54987) Testing: 1. Added a new OpInfo based test `test_neg_view` (verifies that out-of-place and in-place operations work correctly for all operations when the input is a neg view tensor by checking the result against an actually negated tensor, verifies that autograd returns the same output for both neg view and actually negated tensors as well as it works fine when grad_out is a neg view). 2. Added a new test class containing `test_conj_view`, `test_neg_view`. TODO: follow up on #60522 (comment) Differential Revision: [](https://our.internmc.facebook.com/intern/diff/) [ghstack-poisoned]
User facing changes: 1. Adds a negative bit and corresponding new API (`is_neg()`,`resolve_neg()`) 2. `tensor.conj().imag` now returns a floating point tensor with neg bit set to 1 instead of a tensor with no notion of negative bit. Note that imag is still a view and all the view properties still hold for imag. Non user facing changes: 1. Added a new Negative dispatch key and a backend fallback to handle it 2. Updated copy kernel to handle negative bit 3. Merged conjugate and negative bit fallback kernel 4. fixed #60478 (caused due to #54987) Testing: 1. Added a new OpInfo based test `test_neg_view` (verifies that out-of-place and in-place operations work correctly for all operations when the input is a neg view tensor by checking the result against an actually negated tensor, verifies that autograd returns the same output for both neg view and actually negated tensors as well as it works fine when grad_out is a neg view). 2. Added a new test class containing `test_conj_view`, `test_neg_view`. Differential Revision: [](https://our.internmc.facebook.com/intern/diff/) [ghstack-poisoned]
User facing changes: 1. Adds a negative bit and corresponding new API (`is_neg()`,`resolve_neg()`) 2. `tensor.conj().imag` now returns a floating point tensor with neg bit set to 1 instead of a tensor with no notion of negative bit. Note that imag is still a view and all the view properties still hold for imag. Non user facing changes: 1. Added a new Negative dispatch key and a backend fallback to handle it 2. Updated copy kernel to handle negative bit 3. Merged conjugate and negative bit fallback kernel 4. fixed #60478 (caused due to #54987) Testing: 1. Added a new OpInfo based test `test_neg_view` (verifies that out-of-place and in-place operations work correctly for all operations when the input is a neg view tensor by checking the result against an actually negated tensor, verifies that autograd returns the same output for both neg view and actually negated tensors as well as it works fine when grad_out is a neg view). 2. Added a new test class containing `test_conj_view`, `test_neg_view`. Differential Revision: [](https://our.internmc.facebook.com/intern/diff/) [ghstack-poisoned]
User facing changes: 1. Adds a negative bit and corresponding new API (`is_neg()`,`resolve_neg()`) 2. `tensor.conj().imag` now returns a floating point tensor with neg bit set to 1 instead of a tensor with no notion of negative bit. Note that imag is still a view and all the view properties still hold for imag. Non user facing changes: 1. Added a new Negative dispatch key and a backend fallback to handle it 2. Updated copy kernel to handle negative bit 3. Merged conjugate and negative bit fallback kernel 4. fixed #60478 (caused due to #54987) Testing: 1. Added a new OpInfo based test `test_neg_view` (verifies that out-of-place and in-place operations work correctly for all operations when the input is a neg view tensor by checking the result against an actually negated tensor, verifies that autograd returns the same output for both neg view and actually negated tensors as well as it works fine when grad_out is a neg view). 2. Added a new test class containing `test_conj_view`, `test_neg_view`. Differential Revision: [](https://our.internmc.facebook.com/intern/diff/) [ghstack-poisoned]
@anjali411 has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
User facing changes: 1. Adds a negative bit and corresponding new API (`is_neg()`,`resolve_neg()`) 2. `tensor.conj().imag` now returns a floating point tensor with neg bit set to 1 instead of a tensor with no notion of negative bit. Note that imag is still a view and all the view properties still hold for imag. Non user facing changes: 1. Added a new Negative dispatch key and a backend fallback to handle it 2. Updated copy kernel to handle negative bit 3. Merged conjugate and negative bit fallback kernel 4. fixed #60478 (caused due to #54987) Testing: 1. Added a new OpInfo based test `test_neg_view` (verifies that out-of-place and in-place operations work correctly for all operations when the input is a neg view tensor by checking the result against an actually negated tensor, verifies that autograd returns the same output for both neg view and actually negated tensors as well as it works fine when grad_out is a neg view). 2. Added a new test class containing `test_conj_view`, `test_neg_view`. Differential Revision: [](https://our.internmc.facebook.com/intern/diff/) Differential Revision: [D29636403](https://our.internmc.facebook.com/intern/diff/D29636403) [ghstack-poisoned]
@anjali411 has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
User facing changes: 1. Adds a negative bit and corresponding new API (`is_neg()`,`resolve_neg()`) 2. `tensor.conj().imag` now returns a floating point tensor with neg bit set to 1 instead of a tensor with no notion of negative bit. Note that imag is still a view and all the view properties still hold for imag. Non user facing changes: 1. Added a new Negative dispatch key and a backend fallback to handle it 2. Updated copy kernel to handle negative bit 3. Merged conjugate and negative bit fallback kernel 4. fixed #60478 (caused due to #54987) Testing: 1. Added a new OpInfo based test `test_neg_view` (verifies that out-of-place and in-place operations work correctly for all operations when the input is a neg view tensor by checking the result against an actually negated tensor, verifies that autograd returns the same output for both neg view and actually negated tensors as well as it works fine when grad_out is a neg view). 2. Added a new test class containing `test_conj_view`, `test_neg_view`. Differential Revision: [](https://our.internmc.facebook.com/intern/diff/) Differential Revision: [D29636403](https://our.internmc.facebook.com/intern/diff/D29636403) [ghstack-poisoned]
@anjali411 has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
User facing changes: 1. Adds a negative bit and corresponding new API (`is_neg()`,`resolve_neg()`) 2. `tensor.conj().imag` now returns a floating point tensor with neg bit set to 1 instead of a tensor with no notion of negative bit. Note that imag is still a view and all the view properties still hold for imag. Non user facing changes: 1. Added a new Negative dispatch key and a backend fallback to handle it 2. Updated copy kernel to handle negative bit 3. Merged conjugate and negative bit fallback kernel 4. fixed #60478 (caused due to #54987) Testing: 1. Added a new OpInfo based test `test_neg_view` (verifies that out-of-place and in-place operations work correctly for all operations when the input is a neg view tensor by checking the result against an actually negated tensor, verifies that autograd returns the same output for both neg view and actually negated tensors as well as it works fine when grad_out is a neg view). 2. Added a new test class containing `test_conj_view`, `test_neg_view`. Differential Revision: [](https://our.internmc.facebook.com/intern/diff/) Differential Revision: [D29636403](https://our.internmc.facebook.com/intern/diff/D29636403) [ghstack-poisoned]
User facing changes: 1. Adds a negative bit and corresponding new API (`is_neg()`,`resolve_neg()`) 2. `tensor.conj().imag` now returns a floating point tensor with neg bit set to 1 instead of a tensor with no notion of negative bit. Note that imag is still a view and all the view properties still hold for imag. Non user facing changes: 1. Added a new Negative dispatch key and a backend fallback to handle it 2. Updated copy kernel to handle negative bit 3. Merged conjugate and negative bit fallback kernel 4. fixed #60478 (caused due to #54987) Testing: 1. Added a new OpInfo based test `test_neg_view` (verifies that out-of-place and in-place operations work correctly for all operations when the input is a neg view tensor by checking the result against an actually negated tensor, verifies that autograd returns the same output for both neg view and actually negated tensors as well as it works fine when grad_out is a neg view). 2. Added a new test class containing `test_conj_view`, `test_neg_view`. Differential Revision: [](https://our.internmc.facebook.com/intern/diff/) Differential Revision: [D29636403](https://our.internmc.facebook.com/intern/diff/D29636403) [ghstack-poisoned]
User facing changes: 1. Adds a negative bit and corresponding new API (`is_neg()`,`resolve_neg()`) 2. `tensor.conj().imag` now returns a floating point tensor with neg bit set to 1 instead of a tensor with no notion of negative bit. Note that imag is still a view and all the view properties still hold for imag. Non user facing changes: 1. Added a new Negative dispatch key and a backend fallback to handle it 2. Updated copy kernel to handle negative bit 3. Merged conjugate and negative bit fallback kernel 4. fixed #60478 (caused due to #54987) Testing: 1. Added a new OpInfo based test `test_neg_view` (verifies that out-of-place and in-place operations work correctly for all operations when the input is a neg view tensor by checking the result against an actually negated tensor, verifies that autograd returns the same output for both neg view and actually negated tensors as well as it works fine when grad_out is a neg view). 2. Added a new test class containing `test_conj_view`, `test_neg_view`. Differential Revision: [](https://our.internmc.facebook.com/intern/diff/) Differential Revision: [D29636403](https://our.internmc.facebook.com/intern/diff/D29636403) [ghstack-poisoned]
torch/_tensor_str.py
Outdated
@@ -233,10 +233,15 @@ def _tensor_str(self, indent): | |||
self = self.rename(None) | |||
|
|||
summarize = self.numel() > PRINT_OPTS.threshold | |||
|
|||
# handle the negative bit | |||
self = self.resolve_neg() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it's this.
User facing changes: 1. Adds a negative bit and corresponding new API (`is_neg()`,`resolve_neg()`) 2. `tensor.conj().imag` now returns a floating point tensor with neg bit set to 1 instead of a tensor with no notion of negative bit. Note that imag is still a view and all the view properties still hold for imag. Non user facing changes: 1. Added a new Negative dispatch key and a backend fallback to handle it 2. Updated copy kernel to handle negative bit 3. Merged conjugate and negative bit fallback kernel 4. fixed #60478 (caused due to #54987) Testing: 1. Added a new OpInfo based test `test_neg_view` (verifies that out-of-place and in-place operations work correctly for all operations when the input is a neg view tensor by checking the result against an actually negated tensor, verifies that autograd returns the same output for both neg view and actually negated tensors as well as it works fine when grad_out is a neg view). 2. Added a new test class containing `test_conj_view`, `test_neg_view`. Differential Revision: [](https://our.internmc.facebook.com/intern/diff/) Differential Revision: [D29636403](https://our.internmc.facebook.com/intern/diff/D29636403) [ghstack-poisoned]
@anjali411 has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
User facing changes: 1. Adds a negative bit and corresponding new API (`is_neg()`,`resolve_neg()`) 2. `tensor.conj().imag` now returns a floating point tensor with neg bit set to 1 instead of a tensor with no notion of negative bit. Note that imag is still a view and all the view properties still hold for imag. Non user facing changes: 1. Added a new Negative dispatch key and a backend fallback to handle it 2. Updated copy kernel to handle negative bit 3. Merged conjugate and negative bit fallback kernel 4. fixed #60478 (caused due to #54987) Testing: 1. Added a new OpInfo based test `test_neg_view` (verifies that out-of-place and in-place operations work correctly for all operations when the input is a neg view tensor by checking the result against an actually negated tensor, verifies that autograd returns the same output for both neg view and actually negated tensors as well as it works fine when grad_out is a neg view). 2. Added a new test class containing `test_conj_view`, `test_neg_view`. Differential Revision: [](https://our.internmc.facebook.com/intern/diff/) Differential Revision: [D29636403](https://our.internmc.facebook.com/intern/diff/D29636403) [ghstack-poisoned]
@anjali411 has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
This pull request has been merged in 30e48bb. |
ghstack-source-id: 17da0267e28fc58810d439cae643fe4e6de2024d Pull Request resolved: pytorch/pytorch#56058
Stack from ghstack:
User facing changes:
is_neg()
,resolve_neg()
)tensor.conj().imag
now returns a floating point tensor with neg bit set to 1 instead of a tensor with no notion of negative bit. Note that imag is still a view and all the view properties still hold for imag.Non user facing changes:
Testing:
test_neg_view
(verifies that out-of-place and in-place operations work correctly for all operations when the input is a neg view tensor by checking the result against an actually negated tensor, verifies that autograd returns the same output for both neg view and actually negated tensors as well as it works fine when grad_out is a neg view).test_conj_view
,test_neg_view
.Differential Revision:
Differential Revision: D29636403