Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Maximum #17942

Merged
merged 20 commits into from
Jul 21, 2023
Merged
4 changes: 4 additions & 0 deletions ivy/functional/frontends/paddle/tensor/tensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,10 @@ def equal_all(self, y, name=None):
ivy.array_equal(self._ivy_array, _to_ivy_array(y))
)

@with_supported_dtypes({"2.5.0 and below": ("float32", "float64")}, "paddle")
def maximum(self, other, name=None):
return ivy.maximum(self._ivy_array, other)

@with_unsupported_dtypes({"2.5.0 and below": "bfloat16"}, "paddle")
def fmax(self, y, name=None):
return paddle_frontend.Tensor(ivy.fmax(self._ivy_array, _to_ivy_array(y)))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# global
# flake8: noqa
import numpy as np
from hypothesis import assume, given
from hypothesis import strategies as st
Expand Down Expand Up @@ -1840,6 +1841,41 @@ def test_paddle_instance_rad2deg(
)


# maximum
@handle_frontend_method(
class_tree=CLASS_TREE,
init_tree="paddle.to_tensor",
method_name="maximum",
dtype_and_x=helpers.dtype_and_values(
available_dtypes=helpers.get_dtypes("float"),
num_arrays=2,
shared_dtype=True,
),
)
def test_paddle_maximum(
Arwa45 marked this conversation as resolved.
Show resolved Hide resolved
dtype_and_x,
frontend_method_data,
init_flags,
method_flags,
frontend,
on_device,
):
input_dtype, x = dtype_and_x
helpers.test_frontend_method(
init_input_dtypes=input_dtype,
init_all_as_kwargs_np={
"object": x[0],
},
method_input_dtypes=input_dtype,
method_all_as_kwargs_np={"other": x[1]},
frontend=frontend,
frontend_method_data=frontend_method_data,
init_flags=init_flags,
method_flags=method_flags,
on_device=on_device,
)


@handle_frontend_method(
class_tree=CLASS_TREE,
init_tree="paddle.to_tensor",
Expand Down Expand Up @@ -2646,6 +2682,7 @@ def test_paddle_instance_sgn(
on_device=on_device,
)


@handle_frontend_method(
class_tree=CLASS_TREE,
init_tree="paddle.to_tensor",
Expand Down Expand Up @@ -2675,4 +2712,4 @@ def test_paddle_instance_tolist(
method_flags=method_flags,
frontend=frontend,
on_device=on_device,
)
)
Loading