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

fix: mode #23325

Closed
wants to merge 10 commits into from
Closed
Show file tree
Hide file tree
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
10 changes: 10 additions & 0 deletions ivy/functional/frontends/paddle/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,16 @@ def masked_select(x, mask, name=None):
return ivy.flatten(x[mask])


# mode
@with_supported_dtypes(
{"2.5.1 and below": ("float32", "float64", "int32", "int64")},
"paddle",
)
@to_ivy_arrays_and_back
def mode(x, axis=None, keepdim=False, name=None):
return ivy.mode(x, axis=axis, keepdim=keepdim, name=name)


@with_supported_dtypes(
{"2.4.2 and below": ("float32", "float64", "int16", "int32", "int64", "uint8")},
"paddle",
Expand Down
32 changes: 32 additions & 0 deletions ivy_tests/test_ivy/test_frontends/test_paddle/test_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,38 @@ def test_paddle_masked_select(
)


# mode
@handle_frontend_test(
fn_tree="paddle.mode",
dtype_input=helpers.get_dtypes("valid"),
axis=st.none() | st.integers(min_value=0),
keepdim=st.booleans(),
)
def test_paddle_mode(
*,
dtype_input,
axis,
keepdim,
on_device,
fn_tree,
frontend,
backend_fw,
test_flags,
):
x = dtype_input[0]
helpers.test_frontend_function(
input_dtypes=dtype_input,
frontend=frontend,
test_flags=test_flags,
fn_tree=fn_tree,
on_device=on_device,
backend_to_test=backend_fw,
x=x,
axis=axis,
keepdim=keepdim,
)


# nonzero
@handle_frontend_test(
fn_tree="paddle.nonzero",
Expand Down
Loading