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

added reshape and quantile to paddle frontend (test) #22009

Closed
wants to merge 13 commits into from
11 changes: 11 additions & 0 deletions ivy/functional/frontends/paddle/tensor/manipulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,3 +169,14 @@ def take_along_axis(arr, indices, axis):
@to_ivy_arrays_and_back
def rot90(x, k=1, axes=(0, 1), name=None):
return ivy.rot90(x, k=k, axes=axes)


@with_supported_dtypes(
{
"2.5.0 and below": ("float32", "float64", "int32", "int64", "bool")
},
"paddle",
)
@to_ivy_arrays_and_back
def resharp_(x, shape, name=None):
return ivy.reshape(x, shape, name=name)
7 changes: 6 additions & 1 deletion ivy/functional/frontends/paddle/tensor/stat.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,12 @@ def nanquantile(a, q, axis=None, keepdims=False, interpolation="linear", out=Non
a, q, axis=axis, keepdims=keepdims, interpolation=interpolation, out=out
)


@with_unsupported_dtypes({"2.4.2 and below": ("float16", "bfloat16")}, "paddle")
)
@to_ivy_arrays_and_back
def quantile(x, q, axis=None, keepdims=False, name=None, out=None):
return ivy.quantile(x, q, axis=axis, keepdims=keepdims, out=out)

@with_supported_dtypes(
{"2.5.1 and below": ("bool", "float16", "float32", "float64", "int32", "int64")},
"paddle",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -674,3 +674,27 @@ def test_paddle_rot90(
k=k,
axes=tuple(axes),
)

@handle_frontend_test(
fn_tree="paddle.resharp_",
dtype_x_and_shape=_reshape_helper()
)
def test_paddle_resharp_(
*,
dtype_x_and_shape,
on_device,
fn_tree,
frontend,
test_flags,
):
input_dtype, x, shape = dtype_x_and_shape
helpers.test_frontend_function(
input_dtypes=input_dtype,
backend_to_test=backend_fw,
frontend=frontend,
test_flags=test_flags,
fn_tree=fn_tree,
on_device=on_device,
x=x[0],
shape=shape,
)
Original file line number Diff line number Diff line change
Expand Up @@ -193,3 +193,32 @@ def test_paddle_nanmedian(
axis=axis,
keepdim=keepdim,
)

@handle_frontend_test(
fn_tree="paddle.quantile",
dtype_and_x=_statistical_dtype_values(function="quantile"),
keepdims=st.booleans(),
q=st.floats(0.0, 1.0),
)
def test_paddle_quantile(
*,
q,
dtype_and_x,
keepdims,
frontend,
test_flags,
fn_tree,
on_device,
):
input_dtypes, x, axis = dtype_and_x
helpers.test_frontend_function(
input_dtypes=input_dtypes,
frontend=frontend,
test_flags=test_flags,
fn_tree=fn_tree,
on_device=on_device,
x=x[0],
q=q,
axis=axis,
keepdims=keepdims,
)
Loading