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

STD #18031

Merged
merged 10 commits into from
Jul 17, 2023
5 changes: 5 additions & 0 deletions ivy/functional/frontends/paddle/tensor/tensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -559,6 +559,7 @@ def logical_not(self, out=None, name=None):

@with_unsupported_dtypes({"2.5.0 and below": ("float16", "bfloat16")}, "paddle")
def sign(self, name=None):
return ivy.sign(self._ivy_array)
return paddle_frontend.Tensor(ivy.sign(self._ivy_array, np_variant=False))

@with_unsupported_dtypes({"2.5.0 and below": ("float16", "bfloat16")}, "paddle")
Expand All @@ -574,3 +575,7 @@ def tolist(self):
)
def min(self, axis=None, keepdim=False, name=None):
return ivy.min(self._ivy_array, axis=axis, keepdims=keepdim)

@with_unsupported_dtypes({"2.4.2 and below": ("float32", "float64")}, "paddle")
def std(self, axis=None, unbiased=True, keepdim=False, name=None):
return ivy.std(self._ivy_array, axis=axis, keepdims=keepdim)
Original file line number Diff line number Diff line change
Expand Up @@ -2719,3 +2719,44 @@ def test_paddle_instance_min(
method_flags=method_flags,
on_device=on_device,
)


# std
@handle_frontend_method(
class_tree=CLASS_TREE,
init_tree="paddle.to_tensor",
method_name="std",
dtypes_and_x=helpers.dtype_and_values(
available_dtypes=st.one_of(helpers.get_dtypes("float")),
min_axis=-1,
max_axis=0,
),
keep_dims=st.booleans(),
unbiased=st.booleans(),
)
def test_paddle_instance_std(
dtype_x_axis,
keep_dims,
frontend_method_data,
init_flags,
method_flags,
frontend,
on_device,
):
input_dtypes, x, axis = dtype_x_axis
helpers.test_frontend_method(
init_input_dtypes=input_dtypes,
init_all_as_kwargs_np={
"object": x[0],
},
method_input_dtypes=input_dtypes,
method_all_as_kwargs_np={
"axis": axis,
"keepdim": keep_dims,
},
frontend_method_data=frontend_method_data,
init_flags=init_flags,
method_flags=method_flags,
frontend=frontend,
on_device=on_device,
)
Loading