Skip to content

Commit

Permalink
feat: Added floor_mod function in paddle paddle frontend (ivy-llc#26185)
Browse files Browse the repository at this point in the history
  • Loading branch information
Aaryan562 authored and iababio committed Sep 27, 2023
1 parent 6efba3b commit ad6fe32
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
8 changes: 8 additions & 0 deletions ivy/functional/frontends/paddle/math.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,14 @@ def floor_divide(x, y, name=None):
return ivy.floor_divide(x, y)


@with_supported_dtypes(
{"2.5.1 and below": ("float32", "float64", "int32", "int64")}, "paddle"
)
@to_ivy_arrays_and_back
def floor_mod(x, y, name=None):
return ivy.remainder(x, y)


@with_unsupported_dtypes({"2.5.1 and below": "bfloat16"}, "paddle")
@to_ivy_arrays_and_back
def fmax(x, y, name=None):
Expand Down
36 changes: 36 additions & 0 deletions ivy_tests/test_ivy/test_frontends/test_paddle/test_math.py
Original file line number Diff line number Diff line change
Expand Up @@ -995,6 +995,42 @@ def test_paddle_floor_divide(
)


# floor_mod
@handle_frontend_test(
fn_tree="paddle.floor_mod",
dtype_and_x=helpers.dtype_and_values(
available_dtypes=helpers.get_dtypes("valid"),
num_arrays=2,
allow_inf=False,
large_abs_safety_factor=2,
small_abs_safety_factor=2,
safety_factor_scale="log",
shared_dtype=True,
min_value=1,
),
)
def test_paddle_floor_mod(
*,
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],
y=x[1],
)


@handle_frontend_test(
fn_tree="paddle.fmax",
dtypes_and_x=helpers.dtype_and_values(
Expand Down

0 comments on commit ad6fe32

Please sign in to comment.