Skip to content

Commit

Permalink
STD (#18031)
Browse files Browse the repository at this point in the history
  • Loading branch information
tasneemahmed912 authored Jul 17, 2023
1 parent 376a87f commit d802b0b
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
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,
)

0 comments on commit d802b0b

Please sign in to comment.