-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
[new api] add new api paddle.quantile and paddle.Tensor.quantile #38567
Conversation
Thanks for your contribution! |
9e30b94
to
44c235a
Compare
44c235a
to
15293c9
Compare
for q_num in q: | ||
output.append(np.quantile(x, q_num, axis=axis, keepdims=keepdims)) |
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.
np.quantile support q as array, call np.quantile once instead of loop?
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.
done, use np.quantile directly.
if (indices_upper[i] != indices_below[i]): | ||
tensor_below = paddle.take_along_axis(sorted_tensor, | ||
indices_below[i], axis) | ||
tensor_upper = paddle.take_along_axis(sorted_tensor, | ||
indices_upper[i], axis) | ||
weights = (indices[i] - indices_below[i]).astype(x.dtype) | ||
out = paddle.lerp(tensor_below, tensor_upper, weights) | ||
else: | ||
out = paddle.take_along_axis(sorted_tensor, indices_below[i], axis) |
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.
paddle.take_along_axis should support list of index, if there is something wrong, add to do and issue 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.
done, add a todo
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.
LGTM
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.
LGTM
PR types
New features
PR changes
APIs
Describe
add new api paddle.quantile and paddle.Tensor.quantile