Skip to content

Commit

Permalink
feat: add cov to the paddle frontend (#28603)
Browse files Browse the repository at this point in the history
Co-authored-by: ivy-branch <ivy.branch@lets-unify.ai>
Co-authored-by: Sam-Armstrong <samuel_e_armstrong@yahoo.co.uk>
  • Loading branch information
3 people authored Jul 13, 2024
1 parent 7d610c0 commit 084047b
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
9 changes: 9 additions & 0 deletions ivy/functional/frontends/paddle/linalg.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,15 @@ def cond(x, p=None, name=None):
return ret


# cov
@with_supported_dtypes(
{"2.6.1 and below": ("complex64", "complex128", "float32", "float64")}, "paddle"
)
@to_ivy_arrays_and_back
def cov(x, rowvar=True, ddof=True, fweights=None, aweights=None, name=None):
return ivy.cov(x, rowVar=rowvar, ddof=ddof, fweights=fweights, aweights=aweights)


@with_supported_dtypes(
{"2.6.0 and below": ("float32", "float64", "int32", "int64")}, "paddle"
)
Expand Down
34 changes: 34 additions & 0 deletions ivy_tests/test_ivy/test_frontends/test_paddle/test_linalg.py
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,40 @@ def test_paddle_cond(
)


# cov
@handle_frontend_test(
fn_tree="paddle.linalg.cov",
dtype_and_x=helpers.dtype_and_values(
available_dtypes=helpers.get_dtypes("float"),
num_arrays=1,
max_num_dims=2,
),
rowvar=st.booleans(),
ddof=st.booleans(),
)
def test_paddle_cov(
*,
dtype_and_x,
rowvar,
ddof,
frontend,
test_flags,
fn_tree,
backend_fw,
):
input_dtype, x = dtype_and_x
helpers.test_frontend_function(
input_dtypes=input_dtype,
frontend=frontend,
test_flags=test_flags,
backend_to_test=backend_fw,
fn_tree=fn_tree,
x=x,
rowvar=rowvar,
ddof=ddof,
)


# Tests #
# ----- #

Expand Down

0 comments on commit 084047b

Please sign in to comment.