Skip to content

Conversation

@izdeby
Copy link
Contributor

@izdeby izdeby commented Oct 1, 2019

Fixing this issue.
Tested via unit tests

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@izdeby has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@izdeby izdeby requested review from eellison, nairbv and zou3519 October 1, 2019 20:27
Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@izdeby has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

Copy link
Contributor

@zou3519 zou3519 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Let's expand our testing to make sure names are propagated when we pass an out= tensor to torch.eq, torch.ne, etc

self.assertEqual((a > 1).names, ['N', 'C'])
self.assertEqual((a < 1).names, ['N', 'C'])
self.assertEqual((a >= 1).names, ['N', 'C'])
self.assertEqual((a <= 1).names, ['N', 'C'])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be good to add explicit tests for the out= variants. Those can be accessed with torch.eq(a, b, out=blah).

b = torch.randn(3, 3, names=('N', 'C'), device=device)
scalar = torch.randn([], device=device)

self.assertEqual((a == b).names, ['N', 'C'])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: It's possible to write less code by having a list of all of the operations:

ops = [lambda a, b: a == b, lambda a, b: a != b, ...]

and then running them through a for loop. But that makes it harder to pdb into and can be less readable

self.assertEqual((a > scalar).names, ['N', 'C'])
self.assertEqual((a < scalar).names, ['N', 'C'])
self.assertEqual((a >= scalar).names, ['N', 'C'])
self.assertEqual((a <= scalar).names, ['N', 'C'])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you also add support for torch.isnan in this PR? torch.isnan(x) is implemented with x != x, so it should be sufficient to add supports_named_tensor: True to its native_functions entry.

I realized that torch.isinf isn't as simple to add named tensor support for (although it does call a comparison op, it requires zeros_like), so we can punt on that for now.

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@izdeby has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

Copy link
Contributor

@zou3519 zou3519 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you. The linter seems to be complaining but aside from that this looks good.

@zou3519
Copy link
Contributor

zou3519 commented Oct 1, 2019

Here are instructions for how to submit a patch to v1.3.0 #27011, we should do that when this PR gets merged into master.

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@izdeby has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Contributor

@izdeby merged this pull request in 5e776d8.

zdevito pushed a commit to zdevito/ATen that referenced this pull request Oct 2, 2019
Summary:
Fixing this [issue](pytorch/pytorch#27077).
Tested via unit tests
Pull Request resolved: pytorch/pytorch#27162

Differential Revision: D17694187

Pulled By: izdeby

fbshipit-source-id: 939017c91605c89a0e08e0c3f8fe21de93bba95b
@izdeby
Copy link
Contributor Author

izdeby commented Oct 2, 2019

@ailzhang, looks like this PR breaks XLA

@ailzhang
Copy link
Contributor

ailzhang commented Oct 2, 2019

Thanks @izdeby ! The failed tests were caused by one of my PR upstreaming a patch from pytorch/xla to pytorch/pytorch. So it's all good for this PR. :D

izdeby added a commit that referenced this pull request Oct 2, 2019
Summary:
Fixing this [issue](#27077).
Tested via unit tests
Pull Request resolved: #27162

Differential Revision: D17694187

Pulled By: izdeby

fbshipit-source-id: 939017c91605c89a0e08e0c3f8fe21de93bba95b
soumith pushed a commit that referenced this pull request Oct 4, 2019
Summary:
Fixing this [issue](#27077).
Tested via unit tests
Pull Request resolved: #27162

Differential Revision: D17694187

Pulled By: izdeby

fbshipit-source-id: 939017c91605c89a0e08e0c3f8fe21de93bba95b
soumith pushed a commit that referenced this pull request Oct 7, 2019
Summary:
Fixing this [issue](#27077).
Tested via unit tests
Pull Request resolved: #27162

Differential Revision: D17694187

Pulled By: izdeby

fbshipit-source-id: 939017c91605c89a0e08e0c3f8fe21de93bba95b
pdlive215 pushed a commit to pdlive215/pytorch that referenced this pull request Nov 27, 2019
Summary:
Fixing this [issue](pytorch#27077).
Tested via unit tests
Pull Request resolved: pytorch#27162

Differential Revision: D17694187

Pulled By: izdeby

fbshipit-source-id: 939017c91605c89a0e08e0c3f8fe21de93bba95b
thiagocrepaldi pushed a commit to thiagocrepaldi/pytorch that referenced this pull request Feb 4, 2020
Summary:
Fixing this [issue](pytorch#27077).
Tested via unit tests
Pull Request resolved: pytorch#27162

Differential Revision: D17694187

Pulled By: izdeby

fbshipit-source-id: 939017c91605c89a0e08e0c3f8fe21de93bba95b
@facebook-github-bot facebook-github-bot deleted the namedComp branch July 13, 2020 17:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants