-
Notifications
You must be signed in to change notification settings - Fork 25.7k
fix to segmentation fault when empty tensor is passed to choose_qpara… #161966
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
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/161966
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit e073809 with merge base f8ffa91 ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
@pytorchbot merge |
| const float* input_row = input_tensor.const_data_ptr<float>(); | ||
| TORCH_CHECK_VALUE(input_row != nullptr, "input tensor is empty and has no data"); | ||
|
|
||
| if (numel < 0 || numel > input_tensor.numel()) { |
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.
Actually occurred me about whether numel 0 is ever actually valid here, but I don't think we have 0 dim tensors and I don't know how they are treated offhand
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 |
pytorch#161966) …ms_optimized Fixes pytorch#153326 Minimal code to reproduce error: ``` import torch tensor = torch.tensor([]) torch.choose_qparams_optimized( tensor, 0, 200, 0.16, 8 ) ``` Previous Output: `Segmentation fault` Now Output: ``` Traceback (most recent call last): File "/home/amaitra/work/tests/issue_153326.py", line 5, in <module> torch.choose_qparams_optimized( RuntimeError: input tensor is empty and has no data ``` Caused because `const float* input_row =input_tensor.const_data_ptr<float>();` becomes null Pull Request resolved: pytorch#161966 Approved by: https://github.com/Skylion007
pytorch#161966) …ms_optimized Fixes pytorch#153326 Minimal code to reproduce error: ``` import torch tensor = torch.tensor([]) torch.choose_qparams_optimized( tensor, 0, 200, 0.16, 8 ) ``` Previous Output: `Segmentation fault` Now Output: ``` Traceback (most recent call last): File "/home/amaitra/work/tests/issue_153326.py", line 5, in <module> torch.choose_qparams_optimized( RuntimeError: input tensor is empty and has no data ``` Caused because `const float* input_row =input_tensor.const_data_ptr<float>();` becomes null Pull Request resolved: pytorch#161966 Approved by: https://github.com/Skylion007
pytorch#161966) …ms_optimized Fixes pytorch#153326 Minimal code to reproduce error: ``` import torch tensor = torch.tensor([]) torch.choose_qparams_optimized( tensor, 0, 200, 0.16, 8 ) ``` Previous Output: `Segmentation fault` Now Output: ``` Traceback (most recent call last): File "/home/amaitra/work/tests/issue_153326.py", line 5, in <module> torch.choose_qparams_optimized( RuntimeError: input tensor is empty and has no data ``` Caused because `const float* input_row =input_tensor.const_data_ptr<float>();` becomes null Pull Request resolved: pytorch#161966 Approved by: https://github.com/Skylion007
…ms_optimized
Fixes #153326
Minimal code to reproduce error:
Previous Output:
Segmentation faultNow Output:
Caused because
const float* input_row =input_tensor.const_data_ptr<float>();becomes null