-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
Implement named inference rule for mul #23193
Conversation
Featuring: - The named inference rule is actually more complicated than it should be. This is because I'd like to "swap out" named tensor rules (I'm experimenting with two of them) easily. In the future when things are more stable I will return to the callsites and clean up the API. Test Plan: - [namedtensor ci]
Implement named inference rule for mul Featuring: - The named inference rule is actually more complicated than it should be. This is because I'd like to "swap out" named tensor rules (I'm experimenting with two of them) easily. In the future when things are more stable I will return to the callsites and clean up the API. Test Plan: - [namedtensor ci] gh-metadata: pytorch pytorch 23193 gh/zou3519/75/head
Implement named inference rule for mul Featuring: - The named inference rule is actually more complicated than it should be. This is because I'd like to "swap out" named tensor rules (I'm experimenting with two of them) easily. In the future when things are more stable I will return to the callsites and clean up the API. Test Plan: - [namedtensor ci] gh-metadata: pytorch pytorch 23193 gh/zou3519/75/head
Implement named inference rule for mul Featuring: - The named inference rule is actually more complicated than it should be. This is because I'd like to "swap out" named tensor rules (I'm experimenting with two of them) easily. In the future when things are more stable I will return to the callsites and clean up the API. Test Plan: - [namedtensor ci] gh-metadata: pytorch pytorch 23193 gh/zou3519/75/head
Implement named inference rule for mul Featuring: - The named inference rule is actually more complicated than it should be. This is because I'd like to "swap out" named tensor rules (I'm experimenting with two of them) easily. In the future when things are more stable I will return to the callsites and clean up the API. Test Plan: - [namedtensor ci] gh-metadata: pytorch pytorch 23193 gh/zou3519/75/head
aten/src/ATen/native/BinaryOps.cpp
Outdated
@@ -80,6 +83,17 @@ Tensor& mul_out(Tensor& result, const Tensor& self, const Tensor& other) { | |||
return at::_sparse_mul_out(result, self, other); | |||
} | |||
at::assert_no_internal_overlap(result, "mul"); | |||
#ifdef BUILD_NAMEDTENSOR |
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.
Can you implement this in one place in TensorIterator instead of each of the call sites?
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.
Sure, let me look into it.
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.
Thanks for the great suggestion, @colesbury, it worked out really well
Implement named inference rule for mul Featuring: - Implemented name propagation directly in TensorIterator. This also probably enables a lot of other functions but I'll add/enable them in another PR. - Cleaned up old callsites that were using TensorIterator since TensorIterator automatically propagates names. Test Plan: - [namedtensor ci] gh-metadata: pytorch pytorch 23193 gh/zou3519/75/head
Implement named inference rule for mul Featuring: - Implemented name propagation directly in TensorIterator. This also probably enables a lot of other functions but I'll add/enable them in another PR. - Cleaned up old callsites that were using TensorIterator since TensorIterator automatically propagates names. Test Plan: - [namedtensor ci] gh-metadata: pytorch pytorch 23193 gh/zou3519/75/head
Implement named inference rule for mul Featuring: - Implemented name propagation directly in TensorIterator. This also probably enables a lot of other functions but I'll add/enable them in another PR. - Cleaned up old callsites that were using TensorIterator since TensorIterator automatically propagates names. Test Plan: - [namedtensor ci] gh-metadata: pytorch pytorch 23193 gh/zou3519/75/head
|
||
// propagate names | ||
for (int i = 0; i < num_outputs_; i++) { | ||
auto& op = operands_[i]; |
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.
Do you happen to know why Tensor output(int arg=0)
doesn't return a Tensor&
? Seems like it would be nice to be able to use that here.
Implement named inference rule for mul Featuring: - Implemented name propagation directly in TensorIterator. This also probably enables a lot of other functions but I'll add/enable them in another PR. - Cleaned up old callsites that were using TensorIterator since TensorIterator automatically propagates names. Test Plan: - [namedtensor ci] gh-metadata: pytorch pytorch 23193 gh/zou3519/75/head
Implement named inference rule for mul Featuring: - Implemented name propagation directly in TensorIterator. This also probably enables a lot of other functions but I'll add/enable them in another PR. - Cleaned up old callsites that were using TensorIterator since TensorIterator automatically propagates names. Test Plan: - [namedtensor ci] gh-metadata: pytorch pytorch 23193 gh/zou3519/75/head
Summary: Pull Request resolved: pytorch/pytorch#23193 Test Plan: - [namedtensor ci] gh-metadata: pytorch pytorch 23193 gh/zou3519/75/head Imported from OSS Differential Revision: D16494401 Pulled By: zou3519 fbshipit-source-id: 0e2395d7de39158ec51feed5da0389715ec52600
Stack from ghstack:
Featuring:
probably enables a lot of other functions but I'll add/enable them in
another PR.
TensorIterator automatically propagates names.
Test Plan:
gh-metadata: pytorch pytorch 23193 gh/zou3519/75/head
Differential Revision: D16494401