Open hmahmood24 opened 1 year ago
Added quantile function:
@with_supported_dtypes({"float32","float64"})
@to_ivy_arrays_and_back
def quantile(x, q, axis=None, keepdim=False, name=None):
x = ivy.cast(x, ivy.float64) if ivy.dtype(x) == 'float64' else ivy.cast(x, ivy.float32)
sorted_x = ivy.sort(x, axis=axis)
rank = (ivy.shape(sorted_x, axis=axis) - 1) q
rank_int = ivy.floor(rank)
rank_frac = rank - rank_int
lower_values = ivy.gather(sorted_x, ivy.cast(rank_int, ivy.int32), axis=axis)
upper_values = ivy.gather(sorted_x, ivy.cast(rank_int + 1, ivy.int32), axis=axis)
quantile_value = lower_values + rank_frac (upper_values - lower_values)
if not keepdim:
quantile_value = ivy.squeeze(quantile_value, axis=axis)
return quantile_value
Add Statistical Functions to PaddlePaddle Frontend
Please keep in mind that the proper way to link an issue to this list is to comment "- [ ] #issue_number" while the issue's title only includes the name of the function you've chosen.
15426
22067
20867
16387
16639
19176
17345
The main file paths where these functions are likely to be added are:
ivy/functional/frontends/paddle/stat.py
ivy\_tests/test\_ivy/test\_frontends/test\_paddle/test\_stat.py