Repository: ivy-llc/ivy

Issue:
argmax



Discussion:

Resolving patch:
diff --git a/ivy/functional/frontends/jax/devicearray.py b/ivy/functional/frontends/jax/devicearray.py
--- a/ivy/functional/frontends/jax/devicearray.py
+++ b/ivy/functional/frontends/jax/devicearray.py
@@ -46,6 +46,21 @@ def at(self):
     # Instance Methods #
     # ---------------- #
 
+    def argmax(
+        self,
+        /,
+        *,
+        axis=None,
+        out=None,
+        keepdims=False,
+    ):
+        return jax_frontend.numpy.argmax(
+            self._ivy_array,
+            axis=axis,
+            out=out,
+            keepdims=keepdims,
+        )
+
     def __add__(self, other):
         return jax_frontend.numpy.add(self, other)
 
diff --git a/ivy/functional/frontends/jax/numpy/searching_sorting.py b/ivy/functional/frontends/jax/numpy/searching_sorting.py
--- a/ivy/functional/frontends/jax/numpy/searching_sorting.py
+++ b/ivy/functional/frontends/jax/numpy/searching_sorting.py
@@ -9,6 +9,7 @@
 from ivy.functional.frontends.numpy.func_wrapper import from_zero_dim_arrays_to_scalar
 from typing import Union, Optional
 from ivy.func_wrapper import (
+    with_unsupported_dtypes,
     to_native_arrays_and_back,
     handle_out_argument,
     handle_nestable,
@@ -18,8 +19,17 @@
 
 
 @to_ivy_arrays_and_back
+@with_unsupported_dtypes(
+    {
+        "1.11.0 and below": (
+            "float16",
+            "bfloat16",
+        )
+    },
+    "jax",
+)
 def argmax(a, axis=None, out=None, keepdims=False):
-    return ivy.argmax(a, axis=axis, keepdims=keepdims, out=out)
+    return ivy.argmax(a, axis=axis, keepdims=keepdims, out=out, dtype=ivy.int64)
 
 
 @to_ivy_arrays_and_back


Test patch:
diff --git a/ivy_tests/test_ivy/test_frontends/test_jax/test_jax_devicearray.py b/ivy_tests/test_ivy/test_frontends/test_jax/test_jax_devicearray.py
--- a/ivy_tests/test_ivy/test_frontends/test_jax/test_jax_devicearray.py
+++ b/ivy_tests/test_ivy/test_frontends/test_jax/test_jax_devicearray.py
@@ -89,6 +89,46 @@ def test_jax_devicearray_property_at(x_y_index):
     assert x.at[idx].get() == x[idx]
 
 
+@handle_frontend_method(
+    class_tree=CLASS_TREE,
+    init_tree="jax.numpy.array",
+    method_name="argmax",
+    dtype_and_x=helpers.dtype_values_axis(
+        available_dtypes=helpers.get_dtypes("float"),
+        force_int_axis=True,
+        min_num_dims=1,
+        valid_axis=True,
+    ),
+    keepdims=st.booleans(),
+)
+def test_jax_devicearray_argmax(
+    dtype_and_x,
+    keepdims,
+    on_device,
+    frontend,
+    frontend_method_data,
+    init_flags,
+    method_flags,
+):
+    input_dtype, x, axis = 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={
+            "axis": axis,
+            "keepdims": keepdims,
+        },
+        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="jax.numpy.array",