pytorch
a8ca0d48 - fix segmentation fault in QTensor.choose_qparams_optimized (#85552)

Commit
2 years ago
fix segmentation fault in QTensor.choose_qparams_optimized (#85552) Summary: Fixes segmentation fault in `QTensor.choose_qparams_optimized`, this guards against the user passing in a value of `numel` which does not make sense. Fixes https://github.com/pytorch/pytorch/issues/85212 Test plan: Probably not worth it to add a test for this, so testing manually. ``` import torch input = torch.full((64,), 1, dtype=torch.float32, requires_grad=False) numel = 1250999896764 n_bins = 0 ratio = 0 bit_width = 0 torch.choose_qparams_optimized(input, numel, n_bins, ratio, bit_width) // RuntimeError is thrown ``` Pull Request resolved: https://github.com/pytorch/pytorch/pull/85552 Approved by: https://github.com/jerryzh168
Author
Committer
Parents
Loading