Skip to content

Commit

Permalink
add reciprocal inplace function in paddle and passed all tests (#22824)
Browse files Browse the repository at this point in the history
  • Loading branch information
ArsalanAli915 authored Sep 3, 2023
1 parent 2bdbdca commit fc3cd0d
Show file tree
Hide file tree
Showing 2 changed files with 34 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 @@ -410,6 +410,12 @@ def reciprocal(x, name=None):
return ivy.reciprocal(x)


@with_unsupported_dtypes({"2.5.1 and below": ("float16", "bfloat16")}, "paddle")
@to_ivy_arrays_and_back
def reciprocal_(x, name=None):
return ivy.inplace_update(x, reciprocal(x))


@with_unsupported_dtypes({"2.5.1 and below": ("float16", "bfloat16")}, "paddle")
@to_ivy_arrays_and_back
def remainder(x, y, name=None):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1771,6 +1771,34 @@ def test_paddle_reciprocal(
)


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


# remainder
@handle_frontend_test(
fn_tree="paddle.remainder",
Expand Down

0 comments on commit fc3cd0d

Please sign in to comment.