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
[fix] check for histogramdd when bins is int[] #100624
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/100624
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit bb97087: This comment was automatically generated by Dr. CI and updates every 15 minutes. |
const int64_t bin_size = bin_ct.size(); | ||
TORCH_CHECK( | ||
N == bin_size, | ||
"histogramdd: The size of bins must be equal to the innermost dimension of the input."); | ||
for (const auto dim : c10::irange(N)) { | ||
linspace_out(outer_bin_edges.first[dim], outer_bin_edges.second[dim], | ||
bin_ct[dim] + 1, bin_edges_out[dim]); |
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.
We'd end up reading garbage value for bin_ct[dim]
for dim > bin_size.
import torch
# invalid bins
bins = [1, 1, 1, 1, 1]
# Valid bins, all asserts pass.
# bins = [1, 1, 1, 1, 1, 1]
def fn(input):
return torch.histogramdd(input, bins)
x = torch.rand([5, 6], dtype=torch.float32)
# For invalid bins, consecutive call return incorrect output (with different shapes)
o1 = fn(x)
o2 = fn(x)
for o_, oo_ in zip(o1, o2):
# AssertionError: The values for attribute 'shape' do not match: torch.Size([1, 1, 1, 1, 1, 273]) != torch.Size([1, 1, 1, 1, 1, 33]).
torch.testing.assert_close(o_, oo_)
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.
does this function have a decomposition / metafunction? If so, we should add these checks there as well.
# Not implemented on CUDA | ||
DecorateInfo(unittest.expectedFailure, 'TestCommon', 'test_errors', device_type='cuda'), |
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.
Let's add it for the cuda path now that we're at 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.
This operator is not implemented for CUDA.
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.
That's a bug in the implementation of test_errors
then I guess. That's fine.
It doesn't (tried grepping). Also, inductor falls back on the eager implementation. pytorch/torch/_inductor/lowering.py Lines 1556 to 1557 in aa081d8
|
# Not implemented on CUDA | ||
DecorateInfo(unittest.expectedFailure, 'TestCommon', 'test_errors', device_type='cuda'), |
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.
That's a bug in the implementation of test_errors
then I guess. That's fine.
@pytorchbot merge |
Merge failedReason: This PR needs a label If not, please add the To add a label, you can comment to pytorchbot, for example For more information, see Details for Dev Infra teamRaised by workflow job |
@pytorchbot merge |
Merge failedReason: This PR needs a label If not, please add the To add a label, you can comment to pytorchbot, for example For more information, see Details for Dev Infra teamRaised by workflow job |
@pytorchbot merge |
Merge startedYour change will be merged once all checks pass (ETA 0-4 Hours). Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
Fixes pytorch#93274 Pull Request resolved: pytorch#100624 Approved by: https://github.com/lezcano
Fixes #93274