Repository: ivy-llc/ivy

Issue:
argmin

argmin



Discussion:
This issue has been labelled as stale. If you would like to continue working on this issue, then please add another comment or create a PR . If a PR has already been created which refers to this issue, then you should explicitly mention this issue in the relevant PR. For more information please refer to this page in our documentation: https://lets-unify.ai/ivy/contributing/1_the_basics.html#todo-list-issues
Will be working on this.
This issue has been labelled as stale. If you would like to continue working on this issue, then please add another comment or create a PR . If a PR has already been created which refers to this issue, then you should explicitly mention this issue in the relevant PR. For more information please refer to this page in our documentation: https://lets-unify.ai/ivy/contributing/1_the_basics.html#todo-list-issues
Will be working on this.

Resolving patch:
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
@@ -8,6 +8,7 @@
 )
 from ivy.functional.frontends.numpy.func_wrapper import from_zero_dim_arrays_to_scalar
 from ivy.func_wrapper import (
+    with_supported_device_and_dtypes,
     with_unsupported_dtypes,
 )
 
@@ -26,6 +27,58 @@ def argmax(a, axis=None, out=None, keepdims=False):
     return ivy.argmax(a, axis=axis, keepdims=keepdims, out=out, dtype=ivy.int64)
 
 
+# argmin
+@to_ivy_arrays_and_back
+@with_supported_device_and_dtypes(
+    {
+        "0.4.20 and below": {
+            "cpu": (
+                "int16",
+                "int32",
+                "int64",
+                "float32",
+                "float64",
+                "uint8",
+                "uint16",
+                "uint32",
+                "uint64",
+            )
+        }
+    },
+    "jax",
+)
+def argmin(a, axis=None, out=None, keepdims=None):
+    if a is not None:
+        if isinstance(a, list):
+            if all(isinstance(elem, ivy.Array) for elem in a):
+                if len(a) == 1:
+                    a = a[0]
+                else:
+                    return [
+                        ivy.argmin(
+                            ivy.to_native_arrays(elem),
+                            axis=axis,
+                            out=out,
+                            keepdims=keepdims,
+                        )
+                        for elem in a
+                    ]
+            else:
+                raise ValueError(
+                    "Input 'a' must be an Ivy array or a list of Ivy arrays."
+                )
+
+        if not isinstance(a, ivy.Array):
+            raise TypeError("Input 'a' must be an array.")
+
+        if a.size == 0:
+            raise ValueError("Input 'a' must not be empty.")
+
+        return ivy.argmin(a, axis=axis, out=out, keepdims=keepdims)
+    else:
+        raise ValueError("argmin takes at least 1 argument.")
+
+
 @to_ivy_arrays_and_back
 def argsort(a, axis=-1, kind="stable", order=None):
     if kind != "stable":


Test patch:
diff --git a/ivy_tests/test_ivy/test_frontends/test_jax/test_numpy/test_searching_sorting.py b/ivy_tests/test_ivy/test_frontends/test_jax/test_numpy/test_searching_sorting.py
--- a/ivy_tests/test_ivy/test_frontends/test_jax/test_numpy/test_searching_sorting.py
+++ b/ivy_tests/test_ivy/test_frontends/test_jax/test_numpy/test_searching_sorting.py
@@ -105,6 +105,42 @@ def test_jax_argmax(
     )
 
 
+# argmin
+@handle_frontend_test(
+    fn_tree="jax.numpy.argmin",
+    dtype_and_x=helpers.dtype_values_axis(
+        available_dtypes=helpers.get_dtypes("valid"),
+        force_int_axis=True,
+        min_num_dims=1,
+        valid_axis=True,
+    ),
+    keepdims=st.booleans(),
+)
+def test_jax_argmin(
+    *,
+    dtype_and_x,
+    keepdims,
+    on_device,
+    fn_tree,
+    frontend,
+    backend_fw,
+    test_flags,
+):
+    input_dtype, x, axis = 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,
+        a=x[0],
+        axis=axis,
+        out=None,
+        keepdims=keepdims,
+    )
+
+
 # argsort
 @handle_frontend_test(
     fn_tree="jax.numpy.argsort",