Skip to content
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

update document of quantile and nanquantile; test=document_fix #42413

Merged
merged 5 commits into from
Aug 1, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions python/paddle/tensor/stat.py
Original file line number Diff line number Diff line change
Expand Up @@ -440,8 +440,7 @@ def _compute_quantile(x, q, axis=None, keepdim=False, ignore_nan=False):
Compute the quantile of the input along the specified axis.

Args:
Args:
x (Tensor): The input Tensor, it's data type can be float32, float64.
x (Tensor): The input Tensor, it's data type can be float32, float64, int32, int64.
q (int|float|list): The q for calculate quantile, which should be in range [0, 1]. If q is a list,
each q will be calculated and the first dimension of output is same to the number of ``q`` .
axis (int|list, optional): The axis along which to calculate quantile. ``axis`` should be int or list of int.
Expand Down Expand Up @@ -525,7 +524,7 @@ def _compute_quantile(x, q, axis=None, keepdim=False, ignore_nan=False):
if ignore_nan:
indices.append(q_num * (valid_counts - 1))
else:
# TODO(Asthestarsfalll): Use paddle.index_fill instead of where
# TODO: Use paddle.index_fill instead of where
index = q_num * (valid_counts - 1)
last_index = x.shape[axis] - 1
nums = paddle.full_like(index, fill_value=last_index)
Expand Down Expand Up @@ -569,7 +568,7 @@ def quantile(x, q, axis=None, keepdim=False):
If any values in a reduced row are NaN, then the quantiles for that reduction will be NaN.

Args:
x (Tensor): The input Tensor, it's data type can be float32, float64.
x (Tensor): The input Tensor, it's data type can be float32, float64, int32, int64.
q (int|float|list): The q for calculate quantile, which should be in range [0, 1]. If q is a list,
each q will be calculated and the first dimension of output is same to the number of ``q`` .
axis (int|list, optional): The axis along which to calculate quantile. ``axis`` should be int or list of int.
Expand Down Expand Up @@ -629,7 +628,7 @@ def nanquantile(x, q, axis=None, keepdim=False):
If all values in a reduced row are NaN, then the quantiles for that reduction will be NaN.

Args:
x (Tensor): The input Tensor, it's data type can be float32, float64.
x (Tensor): The input Tensor, it's data type can be float32, float64, int32, int64.
q (int|float|list): The q for calculate quantile, which should be in range [0, 1]. If q is a list,
each q will be calculated and the first dimension of output is same to the number of ``q`` .
axis (int|list, optional): The axis along which to calculate quantile. ``axis`` should be int or list of int.
Expand Down