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

Feature/add frontend function paddle tensor nanmean #22514

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
8 changes: 8 additions & 0 deletions ivy/functional/frontends/paddle/tensor/tensor.py
AliTarekk marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -640,3 +640,11 @@ def std(self, axis=None, unbiased=True, keepdim=False, name=None):
)
def trunc(self, name=None):
return paddle_frontend.Tensor(ivy.trunc(self._ivy_array))

@with_supported_dtypes(
{"2.4.2 and below": ("uint16", "float16", "float32", "float64")}, "paddle"
)
def nanmean(self, axis=None, keepdim=False, name=None):
return paddle_frontend.Tensor(
ivy.nanmean(self._ivy_array, axis=axis, keepdims=keepdim)
)
Original file line number Diff line number Diff line change
Expand Up @@ -2947,3 +2947,38 @@ def test_paddle_tensor_trunc(
frontend=frontend,
on_device=on_device,
)


@handle_frontend_method(
class_tree=CLASS_TREE,
init_tree="paddle.to_tensor",
method_name="nanmean",
dtype_and_x=_statistical_dtype_values(function="nanmean"),
keepdim=st.booleans(),
)
def test_paddle_tensor_nanmean(
dtype_and_x,
keepdim,
frontend,
backend_fw,
frontend_method_data,
init_flags,
method_flags,
on_device,
):
input_dtype, x, axis, correction = dtype_and_x
helpers.test_frontend_method(
init_input_dtypes=input_dtype,
init_all_as_kwargs_np={"data": x[0]},
method_input_dtypes=input_dtype,
method_all_as_kwargs_np={
"axis": axis,
"keepdim": keepdim,
},
frontend=frontend,
frontend_method_data=frontend_method_data,
init_flags=init_flags,
backend_to_test=backend_fw,
method_flags=method_flags,
on_device=on_device,
)
Loading