-
Notifications
You must be signed in to change notification settings - Fork 26.3k
TensroIterator preserve format for binary, ternary operators. #28291
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
TensroIterator preserve format for binary, ternary operators. #28291
Conversation
[ghstack-poisoned]
…rs." [ghstack-poisoned]
…nary operators." [ghstack-poisoned]
…ternary operators." [ghstack-poisoned]
…tors." Differential Revision: [D18044977](https://our.internmc.facebook.com/intern/diff/D18044977) [ghstack-poisoned]
…rs." Differential Revision: [D18044977](https://our.internmc.facebook.com/intern/diff/D18044977) [ghstack-poisoned]
…rmat for binary, ternary operators." Differential Revision: [D18044977](https://our.internmc.facebook.com/intern/diff/D18044977) [ghstack-poisoned]
…"TensroIterator preserve format for binary, ternary operators." Differential Revision: [D18044977](https://our.internmc.facebook.com/intern/diff/D18044977) [ghstack-poisoned]
…ary, ternary operators." Differential Revision: [D18044977](https://our.internmc.facebook.com/intern/diff/D18044977) [ghstack-poisoned]
…rve format for binary, ternary operators." Differential Revision: [D18044977](https://our.internmc.facebook.com/intern/diff/D18044977) [ghstack-poisoned]
|
@ngimel I will add tests and benchmark results, so far I just looking your opinion on structure. |
…ry operators." Differential Revision: [D18044977](https://our.internmc.facebook.com/intern/diff/D18044977) [ghstack-poisoned]
…y, ternary operators." Differential Revision: [D18044977](https://our.internmc.facebook.com/intern/diff/D18044977) [ghstack-poisoned]
… operators." Differential Revision: [D18044977](https://our.internmc.facebook.com/intern/diff/D18044977) [ghstack-poisoned]
…ternary operators." Differential Revision: [D18044977](https://our.internmc.facebook.com/intern/diff/D18044977) [ghstack-poisoned]
…rators." Differential Revision: [D18044977](https://our.internmc.facebook.com/intern/diff/D18044977) [ghstack-poisoned]
| # lambda x, y: x.abs(), # https://github.com/pytorch/pytorch/issues/24531 | ||
| # lambda x, y: x.acos(), # https://github.com/pytorch/pytorch/issues/24532 | ||
| lambda x, y: x.add(y, alpha=3), | ||
| lambda x, y: x.addcdiv(2, y, y), |
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.
given that y is contiguous, what are we testing here? Should it have been x, y in the arguments (same for addcmul)
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.
Addressed by adding more tests
| op.tensor = at::empty(tensor_shape, op.options()); | ||
| op.tensor.unsafeGetTensorImpl()->empty_tensor_restride( | ||
| MemoryFormat::ChannelsLast); | ||
| op.stride_bytes = apply_perm_and_mul(op.tensor.strides(), element_size); |
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.
I cannot convince myself that op.stride_bytes and op.tensor.strides() are guaranteed to be consistent (one is defined by perm_ which can be whatever, and the other is hardcoded nhwc), and tests are only testing contiguity of output which is guaranteed by empty_tensor_restride, not its correctness.
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.
Addressed by adding comment
…nary operators." Differential Revision: [D18044977](https://our.internmc.facebook.com/intern/diff/D18044977) [ghstack-poisoned]
…perators." Differential Revision: [D18044977](https://our.internmc.facebook.com/intern/diff/D18044977) [ghstack-poisoned]
…inary, ternary operators." Differential Revision: [D18044977](https://our.internmc.facebook.com/intern/diff/D18044977) [ghstack-poisoned]
… operators." Differential Revision: [D18044977](https://our.internmc.facebook.com/intern/diff/D18044977) [ghstack-poisoned]
…rnary operators." Differential Revision: [D18044977](https://our.internmc.facebook.com/intern/diff/D18044977) [ghstack-poisoned]
…rnary operators." Differential Revision: [D18044977](https://our.internmc.facebook.com/intern/diff/D18044977) [ghstack-poisoned]
…rnary operators." Differential Revision: [D18044977](https://our.internmc.facebook.com/intern/diff/D18044977) [ghstack-poisoned]
|
@VitalyFedyunin merged this pull request in a7df369. |
Summary: Pull Request resolved: pytorch/pytorch#28291 Test Plan: Imported from OSS Differential Revision: D18044977 Pulled By: VitalyFedyunin fbshipit-source-id: 793bab47d8cfc1b0d6229f1b0688352ee94c3e48
Stack from ghstack:
resize_op. #28292 Add memory format support to theresize_op.operator==of TensorOptions as confusing one #28076 Killoperator==of TensorOptions as confusing oneresize_as_operator #27979 Add memory format support toresize_as_operatorDifferential Revision: D18044977