We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
extract


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `ivy/functional/frontends/numpy/sorting_searching_counting/searching.py`
Content:
```
1 # local
2 
3 import ivy
4 
5 from ivy.functional.frontends.numpy import promote_types_of_numpy_inputs
6 
7 from ivy.functional.frontends.numpy.func_wrapper import (
8     to_ivy_arrays_and_back,
9     from_zero_dim_arrays_to_scalar,
10     handle_numpy_out,
11 )
12 
13 
14 @to_ivy_arrays_and_back
15 def where(cond, x1=None, x2=None, /):
16     if x1 is None and x2 is None:
17         # numpy where behaves as np.asarray(condition).nonzero() when x and y
18         # not included
19         return ivy.asarray(cond).nonzero()
20     elif x1 is not None and x2 is not None:
21         x1, x2 = promote_types_of_numpy_inputs(x1, x2)
22         return ivy.where(cond, x1, x2)
23     else:
24         raise ivy.utils.exceptions.IvyException("where takes either 1 or 3 arguments")
25 
26 
27 @to_ivy_arrays_and_back
28 def nonzero(a):
29     return ivy.nonzero(a)
30 
31 
32 @handle_numpy_out
33 @to_ivy_arrays_and_back
34 @from_zero_dim_arrays_to_scalar
35 def argmin(a, /, *, axis=None, keepdims=False, out=None):
36     return ivy.argmin(a, axis=axis, out=out, keepdims=keepdims)
37 
38 
39 @handle_numpy_out
40 @to_ivy_arrays_and_back
41 @from_zero_dim_arrays_to_scalar
42 def argmax(
43     a,
44     /,
45     *,
46     axis=None,
47     out=None,
48     keepdims=False,
49 ):
50     return ivy.argmax(a, axis=axis, out=out, keepdims=keepdims)
51 
52 
53 @to_ivy_arrays_and_back
54 def flatnonzero(a):
55     return ivy.nonzero(ivy.reshape(a, (-1,)))
56 
57 
58 @to_ivy_arrays_and_back
59 def searchsorted(a, v, side="left", sorter=None):
60     return ivy.searchsorted(a, v, side=side, sorter=sorter)
61 
62 
63 @to_ivy_arrays_and_back
64 def argwhere(a):
65     return ivy.argwhere(a)
66 
67 
68 # nanargmin and nanargmax composition helper
69 def _nanargminmax(a, axis=None):
70     # check nans
71     nans = ivy.isnan(a).astype(ivy.bool)
72     # replace nans with inf
73     a = ivy.where(nans, ivy.inf, a)
74     if nans is not None:
75         nans = ivy.all(nans, axis=axis)
76         if ivy.any(nans):
77             raise ivy.utils.exceptions.IvyError("All-NaN slice encountered")
78     return a
79 
80 
81 @handle_numpy_out
82 @to_ivy_arrays_and_back
83 @from_zero_dim_arrays_to_scalar
84 def nanargmax(a, /, *, axis=None, out=None, keepdims=False):
85     a = _nanargminmax(a, axis=axis)
86     return ivy.argmax(a, axis=axis, keepdims=keepdims, out=out)
87 
88 
89 @handle_numpy_out
90 @to_ivy_arrays_and_back
91 @from_zero_dim_arrays_to_scalar
92 def nanargmin(a, /, *, axis=None, out=None, keepdims=False):
93     a = _nanargminmax(a, axis=axis)
94     return ivy.argmin(a, axis=axis, keepdims=keepdims, out=out)
95
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/ivy/functional/frontends/numpy/sorting_searching_counting/searching.py b/ivy/functional/frontends/numpy/sorting_searching_counting/searching.py
--- a/ivy/functional/frontends/numpy/sorting_searching_counting/searching.py
+++ b/ivy/functional/frontends/numpy/sorting_searching_counting/searching.py
@@ -92,3 +92,11 @@
 def nanargmin(a, /, *, axis=None, out=None, keepdims=False):
     a = _nanargminmax(a, axis=axis)
     return ivy.argmin(a, axis=axis, keepdims=keepdims, out=out)
+
+
+@to_ivy_arrays_and_back
+def extract(cond, arr, /):
+    if cond.dtype == 'bool':
+        return arr[cond]
+    else:
+        return arr[cond !=0]
\ No newline at end of file

{"golden_diff": "diff --git a/ivy/functional/frontends/numpy/sorting_searching_counting/searching.py b/ivy/functional/frontends/numpy/sorting_searching_counting/searching.py\n--- a/ivy/functional/frontends/numpy/sorting_searching_counting/searching.py\n+++ b/ivy/functional/frontends/numpy/sorting_searching_counting/searching.py\n@@ -92,3 +92,11 @@\n def nanargmin(a, /, *, axis=None, out=None, keepdims=False):\n     a = _nanargminmax(a, axis=axis)\n     return ivy.argmin(a, axis=axis, keepdims=keepdims, out=out)\n+\n+\n+@to_ivy_arrays_and_back\n+def extract(cond, arr, /):\n+    if cond.dtype == 'bool':\n+        return arr[cond]\n+    else:\n+        return arr[cond !=0]\n\\ No newline at end of file\n", "issue": "extract\n\n", "before_files": [{"content": "# local\n\nimport ivy\n\nfrom ivy.functional.frontends.numpy import promote_types_of_numpy_inputs\n\nfrom ivy.functional.frontends.numpy.func_wrapper import (\n    to_ivy_arrays_and_back,\n    from_zero_dim_arrays_to_scalar,\n    handle_numpy_out,\n)\n\n\n@to_ivy_arrays_and_back\ndef where(cond, x1=None, x2=None, /):\n    if x1 is None and x2 is None:\n        # numpy where behaves as np.asarray(condition).nonzero() when x and y\n        # not included\n        return ivy.asarray(cond).nonzero()\n    elif x1 is not None and x2 is not None:\n        x1, x2 = promote_types_of_numpy_inputs(x1, x2)\n        return ivy.where(cond, x1, x2)\n    else:\n        raise ivy.utils.exceptions.IvyException(\"where takes either 1 or 3 arguments\")\n\n\n@to_ivy_arrays_and_back\ndef nonzero(a):\n    return ivy.nonzero(a)\n\n\n@handle_numpy_out\n@to_ivy_arrays_and_back\n@from_zero_dim_arrays_to_scalar\ndef argmin(a, /, *, axis=None, keepdims=False, out=None):\n    return ivy.argmin(a, axis=axis, out=out, keepdims=keepdims)\n\n\n@handle_numpy_out\n@to_ivy_arrays_and_back\n@from_zero_dim_arrays_to_scalar\ndef argmax(\n    a,\n    /,\n    *,\n    axis=None,\n    out=None,\n    keepdims=False,\n):\n    return ivy.argmax(a, axis=axis, out=out, keepdims=keepdims)\n\n\n@to_ivy_arrays_and_back\ndef flatnonzero(a):\n    return ivy.nonzero(ivy.reshape(a, (-1,)))\n\n\n@to_ivy_arrays_and_back\ndef searchsorted(a, v, side=\"left\", sorter=None):\n    return ivy.searchsorted(a, v, side=side, sorter=sorter)\n\n\n@to_ivy_arrays_and_back\ndef argwhere(a):\n    return ivy.argwhere(a)\n\n\n# nanargmin and nanargmax composition helper\ndef _nanargminmax(a, axis=None):\n    # check nans\n    nans = ivy.isnan(a).astype(ivy.bool)\n    # replace nans with inf\n    a = ivy.where(nans, ivy.inf, a)\n    if nans is not None:\n        nans = ivy.all(nans, axis=axis)\n        if ivy.any(nans):\n            raise ivy.utils.exceptions.IvyError(\"All-NaN slice encountered\")\n    return a\n\n\n@handle_numpy_out\n@to_ivy_arrays_and_back\n@from_zero_dim_arrays_to_scalar\ndef nanargmax(a, /, *, axis=None, out=None, keepdims=False):\n    a = _nanargminmax(a, axis=axis)\n    return ivy.argmax(a, axis=axis, keepdims=keepdims, out=out)\n\n\n@handle_numpy_out\n@to_ivy_arrays_and_back\n@from_zero_dim_arrays_to_scalar\ndef nanargmin(a, /, *, axis=None, out=None, keepdims=False):\n    a = _nanargminmax(a, axis=axis)\n    return ivy.argmin(a, axis=axis, keepdims=keepdims, out=out)\n", "path": "ivy/functional/frontends/numpy/sorting_searching_counting/searching.py"}], "after_files": [{"content": "# local\n\nimport ivy\n\nfrom ivy.functional.frontends.numpy import promote_types_of_numpy_inputs\n\nfrom ivy.functional.frontends.numpy.func_wrapper import (\n    to_ivy_arrays_and_back,\n    from_zero_dim_arrays_to_scalar,\n    handle_numpy_out,\n)\n\n\n@to_ivy_arrays_and_back\ndef where(cond, x1=None, x2=None, /):\n    if x1 is None and x2 is None:\n        # numpy where behaves as np.asarray(condition).nonzero() when x and y\n        # not included\n        return ivy.asarray(cond).nonzero()\n    elif x1 is not None and x2 is not None:\n        x1, x2 = promote_types_of_numpy_inputs(x1, x2)\n        return ivy.where(cond, x1, x2)\n    else:\n        raise ivy.utils.exceptions.IvyException(\"where takes either 1 or 3 arguments\")\n\n\n@to_ivy_arrays_and_back\ndef nonzero(a):\n    return ivy.nonzero(a)\n\n\n@handle_numpy_out\n@to_ivy_arrays_and_back\n@from_zero_dim_arrays_to_scalar\ndef argmin(a, /, *, axis=None, keepdims=False, out=None):\n    return ivy.argmin(a, axis=axis, out=out, keepdims=keepdims)\n\n\n@handle_numpy_out\n@to_ivy_arrays_and_back\n@from_zero_dim_arrays_to_scalar\ndef argmax(\n    a,\n    /,\n    *,\n    axis=None,\n    out=None,\n    keepdims=False,\n):\n    return ivy.argmax(a, axis=axis, out=out, keepdims=keepdims)\n\n\n@to_ivy_arrays_and_back\ndef flatnonzero(a):\n    return ivy.nonzero(ivy.reshape(a, (-1,)))\n\n\n@to_ivy_arrays_and_back\ndef searchsorted(a, v, side=\"left\", sorter=None):\n    return ivy.searchsorted(a, v, side=side, sorter=sorter)\n\n\n@to_ivy_arrays_and_back\ndef argwhere(a):\n    return ivy.argwhere(a)\n\n\n# nanargmin and nanargmax composition helper\ndef _nanargminmax(a, axis=None):\n    # check nans\n    nans = ivy.isnan(a).astype(ivy.bool)\n    # replace nans with inf\n    a = ivy.where(nans, ivy.inf, a)\n    if nans is not None:\n        nans = ivy.all(nans, axis=axis)\n        if ivy.any(nans):\n            raise ivy.utils.exceptions.IvyError(\"All-NaN slice encountered\")\n    return a\n\n\n@handle_numpy_out\n@to_ivy_arrays_and_back\n@from_zero_dim_arrays_to_scalar\ndef nanargmax(a, /, *, axis=None, out=None, keepdims=False):\n    a = _nanargminmax(a, axis=axis)\n    return ivy.argmax(a, axis=axis, keepdims=keepdims, out=out)\n\n\n@handle_numpy_out\n@to_ivy_arrays_and_back\n@from_zero_dim_arrays_to_scalar\ndef nanargmin(a, /, *, axis=None, out=None, keepdims=False):\n    a = _nanargminmax(a, axis=axis)\n    return ivy.argmin(a, axis=axis, keepdims=keepdims, out=out)\n\n\n@to_ivy_arrays_and_back\ndef extract(cond, arr, /):\n    if cond.dtype == 'bool':\n        return arr[cond]\n    else:\n        return arr[cond !=0]", "path": "ivy/functional/frontends/numpy/sorting_searching_counting/searching.py"}]}