Conversation
[ghstack-poisoned]
Differential Revision: [D25502940](https://our.internmc.facebook.com/intern/diff/D25502940) ---------- - Refactor ForeachUnaryOps.cu to better see what dtypes are supported for ops. - Add `has_bool_tensor` checks that will be crucial in next PRs in this stack [ghstack-poisoned]
Differential Revision: [D25502940](https://our.internmc.facebook.com/intern/diff/D25502940) ---------- - Refactor ForeachUnaryOps.cu to better see what dtypes are supported for ops. - Add `has_bool_tensor` checks that will be crucial in next PRs in this stack [ghstack-poisoned]
Differential Revision: [D25502940](https://our.internmc.facebook.com/intern/diff/D25502940) ---------- - Refactor ForeachUnaryOps.cu to better see what dtypes are supported for ops. - Add `has_bool_tensor` checks that will be crucial in next PRs in this stack [ghstack-poisoned]
Differential Revision: [D25502940](https://our.internmc.facebook.com/intern/diff/D25502940) ---------- - Refactor ForeachUnaryOps.cu to better see what dtypes are supported for ops. - Add `has_bool_tensor` checks that will be crucial in next PRs in this stack [ghstack-poisoned]
Differential Revision: [D25502940](https://our.internmc.facebook.com/intern/diff/D25502940) ---------- - Refactor ForeachUnaryOps.cu to better see what dtypes are supported for ops. - Add `has_bool_tensor` checks that will be crucial in next PRs in this stack [ghstack-poisoned]
Differential Revision: [D25502940](https://our.internmc.facebook.com/intern/diff/D25502940) ---------- - Refactor ForeachUnaryOps.cu to better see what dtypes are supported for ops. [ghstack-poisoned]
zou3519
left a comment
There was a problem hiding this comment.
Have some questions and suggestions
| std::vector<Tensor> foreach_tensor_neg_cuda(TensorList tensors) { | ||
| check_foreach_api_restrictions(tensors); | ||
| TORCH_CHECK(tensors[0].scalar_type() != kBool, | ||
| "Negation, the `-` operator, on a bool tensor is not supported. " | ||
| "If you are trying to invert a mask, use the `~` or `logical_not()` operator instead."); | ||
|
|
||
| if (!can_use_fast_route(tensors)) { | ||
| return at::native::foreach_tensor_neg_slow(tensors); | ||
| } | ||
|
|
||
| return foreach_unary_op_complex_bfloat16<std::negate>(tensors); | ||
| return all_types_half_bfloat16<std::negate>(tensors); |
There was a problem hiding this comment.
Why is the new check needed? Also, this updates the semantics of neg, right?
There was a problem hiding this comment.
It doesnt change the behavior but an error. it will match the error of torch.neg in case of bool input
| if (at::isComplexType(t.scalar_type()) || | ||
| at::isIntegralType(t.scalar_type(), /*includeBool=*/true)) { | ||
| has_complex_or_integer = true; |
There was a problem hiding this comment.
This is fixing a bug, right? Should we add a test for it?
There was a problem hiding this comment.
It came from future PRs. I was breaking one PR into pieces and it came here by mistake. removed for now.
Differential Revision: [D25502940](https://our.internmc.facebook.com/intern/diff/D25502940) ---------- - Refactor ForeachUnaryOps.cu to better see what dtypes are supported for ops. [ghstack-poisoned]
zou3519
left a comment
There was a problem hiding this comment.
Thanks, everything is clearer now!
Differential Revision: [D25502940](https://our.internmc.facebook.com/intern/diff/D25502940) ---------- - Refactor ForeachUnaryOps.cu to better see what dtypes are supported for ops. [ghstack-poisoned]
Differential Revision: [D25502940](https://our.internmc.facebook.com/intern/diff/D25502940) ---------- - Refactor ForeachUnaryOps.cu to better see what dtypes are supported for ops. [ghstack-poisoned]
Differential Revision: [D25502940](https://our.internmc.facebook.com/intern/diff/D25502940) ---------- - Refactor ForeachUnaryOps.cu to better see what dtypes are supported for ops. [ghstack-poisoned]
Differential Revision: [D25502940](https://our.internmc.facebook.com/intern/diff/D25502940) ---------- - Refactor ForeachUnaryOps.cu to better see what dtypes are supported for ops. [ghstack-poisoned]
Differential Revision: [D25502940](https://our.internmc.facebook.com/intern/diff/D25502940) ---------- - Refactor ForeachUnaryOps.cu to better see what dtypes are supported for ops. [ghstack-poisoned]
Differential Revision: [D25502940](https://our.internmc.facebook.com/intern/diff/D25502940) ---------- - Refactor ForeachUnaryOps.cu to better see what dtypes are supported for ops. [ghstack-poisoned]
Differential Revision: [D25502940](https://our.internmc.facebook.com/intern/diff/D25502940) ---------- - Refactor ForeachUnaryOps.cu to better see what dtypes are supported for ops. [ghstack-poisoned]
Differential Revision: [D25502940](https://our.internmc.facebook.com/intern/diff/D25502940) ---------- - Refactor ForeachUnaryOps.cu to better see what dtypes are supported for ops. [ghstack-poisoned]
Differential Revision: [D25502940](https://our.internmc.facebook.com/intern/diff/D25502940) ---------- - Refactor ForeachUnaryOps.cu to better see what dtypes are supported for ops. [ghstack-poisoned]
Differential Revision: [D25502940](https://our.internmc.facebook.com/intern/diff/D25502940) ---------- - Refactor ForeachUnaryOps.cu to better see what dtypes are supported for ops. [ghstack-poisoned]
Differential Revision: [D25502940](https://our.internmc.facebook.com/intern/diff/D25502940) ---------- - Refactor ForeachUnaryOps.cu to better see what dtypes are supported for ops. [ghstack-poisoned]
Differential Revision: [D25502940](https://our.internmc.facebook.com/intern/diff/D25502940) ---------- - Refactor ForeachUnaryOps.cu to better see what dtypes are supported for ops. [ghstack-poisoned]
Differential Revision: [D25502940](https://our.internmc.facebook.com/intern/diff/D25502940) ---------- - Refactor ForeachUnaryOps.cu to better see what dtypes are supported for ops. [ghstack-poisoned]
|
@izdeby were Natalia's comments above addressed? #49248 (comment) and #49248 (comment) |
|
This pull request has been reverted by d1bc1ab. |
original PR - #49248 Differential Revision: [D26323605](https://our.internmc.facebook.com/intern/diff/D26323605) [ghstack-poisoned]
original PR - #49248 Differential Revision: [D26323605](https://our.internmc.facebook.com/intern/diff/D26323605) [ghstack-poisoned]
original PR - #49248 Differential Revision: [D26323605](https://our.internmc.facebook.com/intern/diff/D26323605) ------- Refactor ForeachUnaryOps.cu to better see what dtypes are supported for ops. Update abs test to test ints. [ghstack-poisoned]
original PR - #49248 Differential Revision: [D26323605](https://our.internmc.facebook.com/intern/diff/D26323605) ------- Refactor ForeachUnaryOps.cu to better see what dtypes are supported for ops. Update abs test to test ints. [ghstack-poisoned]
original PR - #49248 Differential Revision: [D26323605](https://our.internmc.facebook.com/intern/diff/D26323605) ------- Refactor ForeachUnaryOps.cu to better see what dtypes are supported for ops. Update abs test to test ints. [ghstack-poisoned]
original PR - #49248 Differential Revision: [D26323605](https://our.internmc.facebook.com/intern/diff/D26323605) ------- Refactor ForeachUnaryOps.cu to better see what dtypes are supported for ops. Update abs test to test ints. [ghstack-poisoned]
original PR - #49248 Differential Revision: [D26323605](https://our.internmc.facebook.com/intern/diff/D26323605) ------- Refactor ForeachUnaryOps.cu to better see what dtypes are supported for ops. Update abs test to test ints. [ghstack-poisoned]
original PR - #49248 Differential Revision: [D26323605](https://our.internmc.facebook.com/intern/diff/D26323605) ------- Refactor ForeachUnaryOps.cu to better see what dtypes are supported for ops. Update abs test to test ints. [ghstack-poisoned]
Stack from ghstack:
Differential Revision: D25502940