Skip to content

Commit

Permalink
added paddle.nanmean function frontend and test for it (ivy-llc#23278)
Browse files Browse the repository at this point in the history
  • Loading branch information
sabre-code authored and druvdub committed Oct 14, 2023
1 parent 881c523 commit edd7969
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
6 changes: 6 additions & 0 deletions ivy/functional/frontends/paddle/math.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,12 @@ def multiply(x, y, name=None):
return ivy.multiply(x, y)


@with_supported_dtypes({"2.5.1 and below": ("float32", "float64")}, "paddle")
@to_ivy_arrays_and_back
def nanmean(x, axis=None, keepdims=False):
return ivy.nanmean(x, axis=axis, keepdims=keepdims)


@with_supported_dtypes(
{"2.5.1 and below": ("float32", "float64", "int32", "int64")}, "paddle"
)
Expand Down
31 changes: 31 additions & 0 deletions ivy_tests/test_ivy/test_frontends/test_paddle/test_math.py
Original file line number Diff line number Diff line change
Expand Up @@ -1622,6 +1622,37 @@ def test_paddle_multiply(
)


@handle_frontend_test(
fn_tree="paddle.nanmean",
dtype_and_x=helpers.dtype_and_values(
available_dtypes=helpers.get_dtypes("valid"),
num_arrays=1,
allow_nan=True,
),
)
def test_paddle_nanmean(
*,
dtype_and_x,
on_device,
fn_tree,
frontend,
backend_fw,
test_flags,
):
input_dtype, x = dtype_and_x
helpers.test_frontend_function(
input_dtypes=input_dtype,
backend_to_test=backend_fw,
frontend=frontend,
fn_tree=fn_tree,
test_flags=test_flags,
on_device=on_device,
x=x[0],
rtol=1e-04,
atol=1e-04,
)


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

0 comments on commit edd7969

Please sign in to comment.