Initial implementation of quantile operator (#39417)

Summary:
Implementing the quantile operator similar to [numpy.quantile](https://numpy.org/devdocs/reference/generated/numpy.quantile.html).

For this implementation I'm reducing it to existing torch operators to get free CUDA implementation. It is more efficient to implement multiple quickselect algorithm instead of sorting but this can be addressed in a future PR.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/39417

Reviewed By: mruberry

Differential Revision: D22525217

Pulled By: heitorschueroff

fbshipit-source-id: 27a8bb23feee24fab7f8c228119d19edbb6cea33
This commit is contained in:
Heitor Schueroff de Souza
2020-07-17 10:08:13 -07:00
committed by Facebook GitHub Bot
parent 71fdf748e5
commit c7798ddf7b
9 changed files with 289 additions and 0 deletions

View File

@ -2268,6 +2268,13 @@ qscheme() -> torch.qscheme
Returns the quantization scheme of a given QTensor.
""")
add_docstr_all('quantile',
r"""
quantile(q, dim=None, keepdim=False) -> Tensor
See :func:`torch.quantile`
""")
add_docstr_all('q_scale',
r"""
q_scale() -> float