Skip to content

Commit

Permalink
max function for paddle frontend and the corresponding test (ivy-llc#…
Browse files Browse the repository at this point in the history
  • Loading branch information
AkshayVenkataraman authored Jul 13, 2023
1 parent c0bc86b commit 4ffc7bb
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
8 changes: 8 additions & 0 deletions ivy/functional/frontends/paddle/tensor/math.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,3 +338,11 @@ def maximum(x, y, name=None):
@to_ivy_arrays_and_back
def frac(x, name=None):
return x - ivy.sign(x) * ivy.floor(ivy.abs(x))


@with_supported_dtypes(
{"2.5.0 and below": ("float32", "float64", "int32", "int64")}, "paddle"
)
@to_ivy_arrays_and_back
def max(x, axis=None, keepdim=False, name=None):
return ivy.max(x, axis=axis, keepdims=keepdim)
Original file line number Diff line number Diff line change
Expand Up @@ -1409,3 +1409,35 @@ def test_paddle_frac(
on_device=on_device,
x=x[0],
)


# max
@handle_frontend_test(
fn_tree="paddle.tensor.math.max",
dtype_and_x=helpers.dtype_values_axis(
available_dtypes=helpers.get_dtypes("valid"),
min_axis=-1,
max_axis=0,
min_num_dims=1,
force_int_axis=False,
),
)
def test_paddle_max(
*,
dtype_and_x,
on_device,
fn_tree,
frontend,
test_flags,
):
input_dtype, x, axis = 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],
axis=axis,
keepdim=False,
)

0 comments on commit 4ffc7bb

Please sign in to comment.