Skip to content
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

Closed
wants to merge 10 commits into from

Conversation

zou3519
Copy link
Contributor

@zou3519 zou3519 commented Jul 22, 2019

Stack from ghstack:

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

Differential Revision: D16494401

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]
@pytorchbot pytorchbot added module: internals Related to internal abstractions in c10 and ATen module: operators labels Jul 22, 2019
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
@@ -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
Copy link
Member

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?

Copy link
Contributor Author

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.

Copy link
Contributor Author

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];
Copy link
Collaborator

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
This was referenced Jul 26, 2019
@zou3519 zou3519 deleted the gh/zou3519/75/head branch July 29, 2019 17:01
@facebook-github-bot
Copy link
Contributor

@zou3519 merged this pull request in 505fa83.

zdevito pushed a commit to zdevito/ATen that referenced this pull request Jul 29, 2019
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Merged module: internals Related to internal abstractions in c10 and ATen
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants