Skip to content

Commit

Permalink
Added abs function for paddlepaddle frontend (#15987)
Browse files Browse the repository at this point in the history
  • Loading branch information
yashsandansing authored Jun 2, 2023
1 parent 4927a0a commit b33367c
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
6 changes: 6 additions & 0 deletions ivy/functional/frontends/paddle/tensor/math.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,12 @@ def divide(x, y, name=None):
return ivy.divide(x, y)


@with_unsupported_dtypes({"2.4.2 and below": ("float16", "bfloat16")}, "paddle")
@to_ivy_arrays_and_back
def abs(x, name=None):
return ivy.abs(x)


@with_unsupported_dtypes({"2.4.2 and below": ("float16", "bfloat16")}, "paddle")
@to_ivy_arrays_and_back
def multiply(x, y, name=None):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -536,3 +536,26 @@ def test_paddle_pow(
x=x[0],
y=x[1],
)


@handle_frontend_test(
fn_tree="paddle.tensor.math.abs",
dtype_and_x=helpers.dtype_and_values(available_dtypes=helpers.get_dtypes("float")),
)
def test_paddle_abs(
*,
dtype_and_x,
on_device,
fn_tree,
frontend,
test_flags,
):
input_dtype, x = dtype_and_x
helpers.test_frontend_function(
input_dtypes=input_dtype,
frontend=frontend,
test_flags=test_flags,
fn_tree=fn_tree,
on_device=on_device,
x=x[0],
)

0 comments on commit b33367c

Please sign in to comment.