Repository: ivy-llc/ivy

Issue:
amax



Discussion:

Resolving patch:
diff --git a/ivy/functional/frontends/paddle/tensor/math.py b/ivy/functional/frontends/paddle/tensor/math.py
--- a/ivy/functional/frontends/paddle/tensor/math.py
+++ b/ivy/functional/frontends/paddle/tensor/math.py
@@ -180,3 +180,9 @@ def neg(x, name=None):
 @to_ivy_arrays_and_back
 def exp(x, name=None):
     return ivy.exp(x)
+
+
+@with_unsupported_dtypes({"2.4.2 and below": ("float32", "float64", "int32", "int64")}, "paddle")
+@to_ivy_arrays_and_back
+def amax(x, axis=None, keepdim=False, name=None):
+    return ivy.amax(x, axis=axis, keepdims=keepdim)
diff --git a/ivy/functional/frontends/paddle/tensor/tensor.py b/ivy/functional/frontends/paddle/tensor/tensor.py
--- a/ivy/functional/frontends/paddle/tensor/tensor.py
+++ b/ivy/functional/frontends/paddle/tensor/tensor.py
@@ -195,3 +195,7 @@ def all(self, axis=None, keepdim=False, dtype=None, name=None):
     @with_unsupported_dtypes({"2.4.2 and below": ("float16", "bfloat16")}, "paddle")
     def sort(self, axis=-1, descending=False, name=None):
         return ivy.sort(self._ivy_array, axis=axis, descending=descending)
+    
+    @with_unsupported_dtypes({"2.4.2 and below": ("float32", "float64", "int32", "int64")}, "paddle")
+    def amax(self, axis=None, keepdim=False, name=None):
+        return ivy.amax(self._ivy_array, axis=axis, keepdims=keepdim) 


Test patch:
diff --git a/ivy_tests/test_ivy/test_frontends/test_paddle/test_tensor/test_paddle_math.py b/ivy_tests/test_ivy/test_frontends/test_paddle/test_tensor/test_paddle_math.py
--- a/ivy_tests/test_ivy/test_frontends/test_paddle/test_tensor/test_paddle_math.py
+++ b/ivy_tests/test_ivy/test_frontends/test_paddle/test_tensor/test_paddle_math.py
@@ -800,3 +800,34 @@ def test_paddle_exp(
         on_device=on_device,
         x=x[0],
     )
+
+
+# amax
+@handle_frontend_test(
+    fn_tree="paddle.tensor.math.amax",
+    dtype_and_x=helpers.dtype_and_values(
+        available_dtypes=helpers.get_dtypes("float", "int"),
+        min_axis=None,
+        max_axis=4,
+        min_num_dims=0,
+        max_num_dims=4,
+        force_int_axis=False,
+    ),
+)
+def test_paddle_amax(
+    *,
+    dtype_and_x,
+    frontend,
+    test_flags,
+    fn_tree,
+    on_device,
+):
+    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],
+    )
\ No newline at end of file
diff --git a/ivy_tests/test_ivy/test_frontends/test_paddle/test_tensor/test_paddle_tensor.py b/ivy_tests/test_ivy/test_frontends/test_paddle/test_tensor/test_paddle_tensor.py
--- a/ivy_tests/test_ivy/test_frontends/test_paddle/test_tensor/test_paddle_tensor.py
+++ b/ivy_tests/test_ivy/test_frontends/test_paddle/test_tensor/test_paddle_tensor.py
@@ -1062,3 +1062,46 @@ def test_paddle_erf(
         frontend=frontend,
         on_device=on_device,
     )
+
+
+# amax
+@handle_frontend_method(
+    class_tree=CLASS_TREE,
+    init_tree="paddle.to_tensor",
+    method_name="amax",
+    dtype_x_axis=helpers.dtype_values_axis(
+        available_dtypes=st.one_of(helpers.get_dtypes("float", "int")),
+        min_axis=None,
+        max_axis=4,
+        min_num_dims=0,
+        max_num_dims=4,
+        force_int_axis=False,
+    ),
+    keep_dims=st.booleans(),
+)
+def test_paddle_amax(
+    dtype_x_axis,
+    keep_dims,
+    frontend_method_data,
+    init_flags,
+    method_flags,
+    frontend,
+    on_device,
+):
+    input_dtypes, x, axis = dtype_x_axis
+    helpers.test_frontend_method(
+        init_input_dtypes=input_dtypes,
+        init_all_as_kwargs_np={
+            "object": x[0],
+        },
+        method_input_dtypes=input_dtypes,
+        method_all_as_kwargs_np={
+            "axis": axis,
+            "keepdim": keep_dims,
+        },
+        frontend=frontend,
+        frontend_method_data=frontend_method_data,
+        init_flags=init_flags,
+        method_flags=method_flags,
+        on_device=on_device,
+    )
\ No newline at end of file