internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: ivy-llc/ivy

Issue:
[Bug]: TypeError when converting axis to tuple. Not the correct way to initialise a tuple
### Bug Explanation

I encountered a TypeError while attempting to convert the `axis` variable to a tuple. The error occurred because `axis` was initially assigned an integer value, which is not iterable. [Link](https://github.com/unifyai/ivy/blob/master/ivy/functional/backends/jax/linear_algebra.py#L199) 

### Steps to Reproduce Bug

Call the `matrix_norm` function and pass `axis` as any integer.

### Environment

Windows 11, VSCode, conda python interpreter. 

### Ivy Version

Latest master

### Backend

- [ ] TensorFlow
- [ ] NumPy
- [ ] PyTorch
- [X] JAX

### Device

_No response_


Discussion:

Resolving patch:
diff --git a/ivy/functional/backends/jax/linear_algebra.py b/ivy/functional/backends/jax/linear_algebra.py
--- a/ivy/functional/backends/jax/linear_algebra.py
+++ b/ivy/functional/backends/jax/linear_algebra.py
@@ -195,8 +195,12 @@ def matrix_norm(
     keepdims: bool = False,
     out: Optional[JaxArray] = None,
 ) -> JaxArray:
-    if not isinstance(axis, tuple):
-        axis = tuple(axis)
+    if hasattr(axis, '__iter__'):
+        if not isinstance(axis, tuple):
+            axis = tuple(axis)
+    else:
+        if not isinstance(axis, tuple):
+            axis = (axis, )
     return jnp.linalg.norm(x, ord=ord, axis=axis, keepdims=keepdims)
 
 


Test patch:
Repository: ivy-llc/ivy

Issue:
extract



Discussion:

Resolving patch:
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 nanargmax(a, /, *, axis=None, out=None, keepdims=False):
 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


Test patch:
diff --git a/ivy_tests/test_ivy/test_frontends/test_numpy/test_sorting_searching_counting/test_searching.py b/ivy_tests/test_ivy/test_frontends/test_numpy/test_sorting_searching_counting/test_searching.py
--- a/ivy_tests/test_ivy/test_frontends/test_numpy/test_sorting_searching_counting/test_searching.py
+++ b/ivy_tests/test_ivy/test_frontends/test_numpy/test_sorting_searching_counting/test_searching.py
@@ -343,3 +343,45 @@ def test_numpy_nanargmin(
         axis=axis,
         keepdims=keep_dims,
     )
+
+
+@st.composite
+def _extract_strategy(draw):
+    dtype_and_cond = draw(
+        helpers.dtype_and_values(
+            available_dtypes=helpers.get_dtypes("valid"),
+        )
+    )
+    dtype_and_arr = draw(
+        helpers.dtype_and_values(
+            available_dtypes=helpers.get_dtypes("valid"),
+        )
+    )
+    return dtype_and_cond, dtype_and_arr
+
+
+# extract
+@handle_frontend_test(
+    fn_tree="numpy.extract",
+    dtype_and_x=_extract_strategy(),
+    test_with_out=st.just(False),
+)
+def test_numpy_extract(
+    dtype_and_x,
+    frontend,
+    test_flags,
+    fn_tree,
+    on_device,
+):
+    dtype_cond, cond = dtype_and_x[0]
+    dtype_arr, arr = dtype_and_x[1]
+
+    helpers.test_frontend_function(
+        input_dtypes=dtype_cond + dtype_arr,
+        frontend=frontend,
+        test_flags=test_flags,
+        fn_tree=fn_tree,
+        on_device=on_device,
+        cond=cond[0],
+        arr=arr[0],
+    )
Repository: ivy-llc/ivy

Issue:
torch.Tensor.__matmul__



Discussion:

Resolving patch:
diff --git a/ivy/functional/frontends/torch/tensor.py b/ivy/functional/frontends/torch/tensor.py
--- a/ivy/functional/frontends/torch/tensor.py
+++ b/ivy/functional/frontends/torch/tensor.py
@@ -893,6 +893,10 @@ def __radd__(self, other):
     def __mul__(self, other):
         return torch_frontend.mul(self, other)
 
+    @with_unsupported_dtypes({"1.11.0 and below": "bfloat16"}, "torch")
+    def __matmul__(self, other):
+        return torch_frontend.matmul(self, other)
+
     @with_unsupported_dtypes({"1.11.0 and below": ("bfloat16",)}, "torch")
     def __rmul__(self, other):
         return torch_frontend.mul(other, self)


Test patch:
diff --git a/ivy_tests/test_ivy/test_frontends/test_torch/test_tensor.py b/ivy_tests/test_ivy/test_frontends/test_torch/test_tensor.py
--- a/ivy_tests/test_ivy/test_frontends/test_torch/test_tensor.py
+++ b/ivy_tests/test_ivy/test_frontends/test_torch/test_tensor.py
@@ -1892,6 +1892,47 @@ def test_torch_special_mul(
     )
 
 
+@st.composite
+def _get_dtype_and_multiplicative_matrices(draw):
+    return draw(
+        st.one_of(
+            _get_dtype_input_and_matrices(),
+            _get_dtype_and_3dbatch_matrices(),
+        )
+    )
+
+
+# __matmul__
+@handle_frontend_method(
+    class_tree=CLASS_TREE,
+    init_tree="torch.tensor",
+    method_name="__matmul__",
+    dtype_tensor1_tensor2=_get_dtype_and_multiplicative_matrices(),
+)
+def test_torch_special_matmul(
+    dtype_tensor1_tensor2,
+    frontend_method_data,
+    init_flags,
+    method_flags,
+    frontend,
+    on_device,
+):
+    dtype, tensor1, tensor2 = dtype_tensor1_tensor2
+    helpers.test_frontend_method(
+        init_input_dtypes=dtype,
+        init_all_as_kwargs_np={
+            "data": tensor1,
+        },
+        method_input_dtypes=dtype,
+        method_all_as_kwargs_np={"other": tensor2},
+        frontend_method_data=frontend_method_data,
+        init_flags=init_flags,
+        method_flags=method_flags,
+        frontend=frontend,
+        on_device=on_device,
+    )
+
+
 # __rsub__
 @handle_frontend_method(
     class_tree=CLASS_TREE,
Repository: ivy-llc/ivy

Issue:
fmod



Discussion:

Resolving patch:
diff --git a/ivy/functional/frontends/torch/tensor.py b/ivy/functional/frontends/torch/tensor.py
--- a/ivy/functional/frontends/torch/tensor.py
+++ b/ivy/functional/frontends/torch/tensor.py
@@ -1068,3 +1068,7 @@ def addcdiv(self, tensor1, tensor2, *, value=1):
     @with_unsupported_dtypes({"1.11.0 and below": sign_decorator_dtypes}, "torch")
     def sign(self):
         return torch_frontend.sign(self._ivy_array)
+
+    @with_unsupported_dtypes({"1.11.0 and below": ("float16", "bfloat16")}, "torch")
+    def fmod(self, other, *, out=None):
+        return torch_frontend.fmod(self, other, out=out)


Test patch:
diff --git a/ivy_tests/test_ivy/test_frontends/test_torch/test_tensor.py b/ivy_tests/test_ivy/test_frontends/test_torch/test_tensor.py
--- a/ivy_tests/test_ivy/test_frontends/test_torch/test_tensor.py
+++ b/ivy_tests/test_ivy/test_frontends/test_torch/test_tensor.py
@@ -7616,3 +7616,39 @@ def test_torch_instance_sign(
         frontend=frontend,
         on_device=on_device,
     )
+
+
+# fmod
+@handle_frontend_method(
+    class_tree=CLASS_TREE,
+    init_tree="torch.tensor",
+    method_name="fmod",
+    dtype_and_x=helpers.dtype_and_values(
+        available_dtypes=helpers.get_dtypes("float"),
+        num_arrays=2,
+        shared_dtype=True,
+        min_num_dims=1,
+        min_value=-100,
+        max_value=100,
+    ),
+)
+def test_torch_instance_fmod(
+    dtype_and_x,
+    frontend,
+    frontend_method_data,
+    init_flags,
+    method_flags,
+    on_device,
+):
+    input_dtype, x = dtype_and_x
+    helpers.test_frontend_method(
+        init_input_dtypes=input_dtype,
+        init_all_as_kwargs_np={"data": 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,
+    )
Repository: ivy-llc/ivy

Issue:
 torch.Tensor.fmod_



Discussion:

Resolving patch:
diff --git a/ivy/functional/frontends/torch/tensor.py b/ivy/functional/frontends/torch/tensor.py
--- a/ivy/functional/frontends/torch/tensor.py
+++ b/ivy/functional/frontends/torch/tensor.py
@@ -1090,3 +1090,8 @@ def sign(self):
     @with_unsupported_dtypes({"1.11.0 and below": ("float16", "bfloat16")}, "torch")
     def fmod(self, other, *, out=None):
         return torch_frontend.fmod(self, other, out=out)
+
+    @with_unsupported_dtypes({"1.11.0 and below": ("float16", "bfloat16")}, "torch")
+    def fmod_(self, other, *, out=None):
+        self.ivy_array = self.fmod(other, out=out).ivy_array
+        return self


Test patch:
diff --git a/ivy_tests/test_ivy/test_frontends/test_torch/test_tensor.py b/ivy_tests/test_ivy/test_frontends/test_torch/test_tensor.py
--- a/ivy_tests/test_ivy/test_frontends/test_torch/test_tensor.py
+++ b/ivy_tests/test_ivy/test_frontends/test_torch/test_tensor.py
@@ -7800,3 +7800,39 @@ def test_torch_instance_fmod(
         method_flags=method_flags,
         on_device=on_device,
     )
+
+
+# fmod_
+@handle_frontend_method(
+    class_tree=CLASS_TREE,
+    init_tree="torch.tensor",
+    method_name="fmod_",
+    dtype_and_x=helpers.dtype_and_values(
+        available_dtypes=helpers.get_dtypes("float"),
+        num_arrays=2,
+        shared_dtype=True,
+        min_num_dims=1,
+        min_value=-100,
+        max_value=100,
+    ),
+)
+def test_torch_instance_fmod_(
+    dtype_and_x,
+    frontend,
+    frontend_method_data,
+    init_flags,
+    method_flags,
+    on_device,
+):
+    input_dtype, x = dtype_and_x
+    helpers.test_frontend_method(
+        init_input_dtypes=input_dtype,
+        init_all_as_kwargs_np={"data": 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,
+    )
Repository: ivy-llc/ivy

Issue:
cosine_similarity



Discussion:

Resolving patch:
diff --git a/ivy/functional/frontends/tensorflow/keras/metrics.py b/ivy/functional/frontends/tensorflow/keras/metrics.py
--- a/ivy/functional/frontends/tensorflow/keras/metrics.py
+++ b/ivy/functional/frontends/tensorflow/keras/metrics.py
@@ -301,10 +301,7 @@ def cosine_similarity(y_true, y_pred):
 
     if len(y_pred.shape) == len(y_pred.shape) and len(y_true.shape) == 2:
         numerator = ivy.sum(y_true * y_pred, axis=1)
-        denominator = ivy.matrix_norm(y_true) * ivy.matrix_norm(y_pred)
     else:
         numerator = ivy.vecdot(y_true, y_pred)
-        denominator = ivy.matrix_norm(y_true) * ivy.matrix_norm(y_pred)
-
-    cosine = numerator / denominator
-    return cosine
+    denominator = ivy.matrix_norm(y_true) * ivy.matrix_norm(y_pred)
+    return numerator / denominator


Test patch:
Repository: ivy-llc/ivy

Issue:
eigh



Discussion:

Resolving patch:
diff --git a/ivy/functional/frontends/numpy/linalg/matrix_eigenvalues.py b/ivy/functional/frontends/numpy/linalg/matrix_eigenvalues.py
--- a/ivy/functional/frontends/numpy/linalg/matrix_eigenvalues.py
+++ b/ivy/functional/frontends/numpy/linalg/matrix_eigenvalues.py
@@ -17,6 +17,7 @@ def eig(a):
     return ivy.eig(a)
 
 
+@to_ivy_arrays_and_back
 @from_zero_dim_arrays_to_scalar
 def eigh(a, /, UPLO="L"):
     return ivy.eigh(a, UPLO=UPLO)


Test patch:
Repository: ivy-llc/ivy

Issue:
correlate



Discussion:

Resolving patch:
diff --git a/ivy/functional/frontends/jax/numpy/statistical.py b/ivy/functional/frontends/jax/numpy/statistical.py
--- a/ivy/functional/frontends/jax/numpy/statistical.py
+++ b/ivy/functional/frontends/jax/numpy/statistical.py
@@ -467,3 +467,40 @@ def nanmedian(
     return ivy.nanmedian(
         a, axis=axis, keepdims=keepdims, out=out, overwrite_input=overwrite_input
     )
+
+
+@to_ivy_arrays_and_back
+@with_unsupported_dtypes({"2.9.0 and below": ("float16", "bfloat16")}, "tensorflow")
+def correlate(a, v, mode="valid", precision=None):
+    if ivy.get_num_dims(a) != 1 or ivy.get_num_dims(v) != 1:
+        raise ValueError("correlate() only support 1-dimensional inputs.")
+    if a.shape[0] == 0 or v.shape[0] == 0:
+        raise ValueError(
+            f"correlate: inputs cannot be empty, got shapes {a.shape} and {v.shape}."
+        )
+    if v.shape[0] > a.shape[0]:
+        need_flip = True
+        a, v = v, a
+    else:
+        need_flip = False
+
+    out_order = slice(None)
+
+    if mode == "valid":
+        padding = [(0, 0)]
+    elif mode == "same":
+        padding = [(v.shape[0] // 2, v.shape[0] - v.shape[0] // 2 - 1)]
+    elif mode == "full":
+        padding = [(v.shape[0] - 1, v.shape[0] - 1)]
+    else:
+        raise ValueError("mode must be one of ['full', 'same', 'valid']")
+
+    result = ivy.conv_general_dilated(
+        a[None, None, :],
+        v[:, None, None],
+        (1,),
+        padding,
+        dims=1,
+        data_format="channel_first",
+    )
+    return ivy.flip(result[0, 0, out_order]) if need_flip else result[0, 0, out_order]


Test patch:
diff --git a/ivy_tests/test_ivy/test_frontends/test_jax/test_jax_numpy_statistical.py b/ivy_tests/test_ivy/test_frontends/test_jax/test_jax_numpy_statistical.py
--- a/ivy_tests/test_ivy/test_frontends/test_jax/test_jax_numpy_statistical.py
+++ b/ivy_tests/test_ivy/test_frontends/test_jax/test_jax_numpy_statistical.py
@@ -974,6 +974,7 @@ def test_jax_numpy_nanmean(
     )
 
 
+# nanmedian
 @handle_frontend_test(
     fn_tree="jax.numpy.nanmedian",
     dtype_x_axis=helpers.dtype_values_axis(
@@ -1008,3 +1009,41 @@ def test_jax_numpy_nanmedian(
         overwrite_input=False,
         keepdims=keepdims,
     )
+
+
+# correlate
+@handle_frontend_test(
+    fn_tree="jax.numpy.correlate",
+    dtype_and_x=helpers.dtype_and_values(
+        available_dtypes=helpers.get_dtypes("float"),
+        num_arrays=2,
+        min_num_dims=1,
+        max_num_dims=1,
+        min_value=-1e04,
+        max_value=1e04,
+        shared_dtype=True,
+    ),
+    mode=st.sampled_from(["valid", "same", "full"]),
+)
+def test_jax_numpy_correlate(
+    *,
+    dtype_and_x,
+    on_device,
+    fn_tree,
+    frontend,
+    test_flags,
+    mode,
+):
+    input_dtype, x = dtype_and_x
+    helpers.test_frontend_function(
+        input_dtypes=input_dtype,
+        frontend=frontend,
+        test_flags=test_flags,
+        fn_tree=fn_tree,
+        rtol=1e-4,
+        atol=1e-4,
+        on_device=on_device,
+        a=x[0],
+        v=x[1],
+        mode=mode,
+    )
Repository: ivy-llc/ivy

Issue:
cosh



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
@@ -18,16 +18,19 @@ def cos(x, name=None):
     return ivy.cos(x)
 
 
-
 @with_unsupported_dtypes({"2.4.2 and below": ("float16", "bfloat16")}, "paddle")
 @to_ivy_arrays_and_back
 def acos(x, name=None):
     return ivy.acos(x)
 
 
+@with_unsupported_dtypes({"2.4.2 and below": ("float16", "bfloat16")}, "paddle")
+@to_ivy_arrays_and_back
+def cosh(x, name=None):
+    return ivy.cosh(x)
+
 
 @with_unsupported_dtypes({"2.4.2 and below": ("float16", "bfloat16")}, "paddle")
 @to_ivy_arrays_and_back
 def tanh(x, name=None):
     return ivy.tanh(x)
-


Test patch:
diff --git a/ivy_tests/test_ivy/test_frontends/test_paddle/test_tensor/test_math.py b/ivy_tests/test_ivy/test_frontends/test_paddle/test_tensor/test_math.py
--- a/ivy_tests/test_ivy/test_frontends/test_paddle/test_tensor/test_math.py
+++ b/ivy_tests/test_ivy/test_frontends/test_paddle/test_tensor/test_math.py
@@ -56,7 +56,7 @@ def test_paddle_cos(
         x=x[0],
     )
 
-    
+
 # acos
 @handle_frontend_test(
     fn_tree="paddle.acos",
@@ -84,6 +84,33 @@ def test_paddle_acos(
     )
 
 
+# cosh
+@handle_frontend_test(
+    fn_tree="paddle.tensor.math.cosh",
+    dtype_and_x=helpers.dtype_and_values(
+        available_dtypes=helpers.get_dtypes("float"),
+    ),
+)
+def test_paddle_cosh(
+    *,
+    dtype_and_x,
+    on_device,
+    fn_tree,
+    frontend,
+    test_flags,
+):
+    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,
+        atol=1e-2,
+        x=x[0],
+    )
+
+
 # tanh
 @handle_frontend_test(
     fn_tree="paddle.tensor.math.tanh",
Repository: ivy-llc/ivy

Issue:
mean



Discussion:

Resolving patch:
diff --git a/ivy/functional/frontends/paddle/__init__.py b/ivy/functional/frontends/paddle/__init__.py
--- a/ivy/functional/frontends/paddle/__init__.py
+++ b/ivy/functional/frontends/paddle/__init__.py
@@ -228,6 +228,7 @@ def promote_types_of_paddle_inputs(
 from .tensor.random import *
 from .tensor.search import *
 from .tensor.einsum import *
+from .tensor.stat import *
 
 from .tensor.tensor import Tensor
 
diff --git a/ivy/functional/frontends/paddle/tensor/stat.py b/ivy/functional/frontends/paddle/tensor/stat.py
--- a/ivy/functional/frontends/paddle/tensor/stat.py
+++ b/ivy/functional/frontends/paddle/tensor/stat.py
@@ -1 +1,11 @@
 # global
+import ivy
+from ivy.func_wrapper import with_unsupported_dtypes
+from ivy.functional.frontends.paddle.func_wrapper import (
+    to_ivy_arrays_and_back,
+)
+
+@with_unsupported_dtypes({"2.4.2 and below": ("float16", "bfloat16")}, "paddle")
+@to_ivy_arrays_and_back
+def mean(input, axis=None, keepdims=False, out=None):
+    return ivy.std(input, axis=axis, keepdims=keepdims, out=None)


Test patch:
diff --git a/ivy_tests/test_ivy/test_frontends/test_paddle/test_tensor/test_paddle_stat.py b/ivy_tests/test_ivy/test_frontends/test_paddle/test_tensor/test_paddle_stat.py
--- a/ivy_tests/test_ivy/test_frontends/test_paddle/test_tensor/test_paddle_stat.py
+++ b/ivy_tests/test_ivy/test_frontends/test_paddle/test_tensor/test_paddle_stat.py
@@ -1,3 +1,36 @@
 # global
+from hypothesis import strategies as st
 
 # local
+import ivy_tests.test_ivy.helpers as helpers
+from ivy_tests.test_ivy.helpers import handle_frontend_test
+from ivy_tests.test_ivy.test_functional.test_core.test_statistical import (
+    statistical_dtype_values,
+)
+
+# mean
+@handle_frontend_test(
+    fn_tree="paddle.mean",
+    dtype_and_x=statistical_dtype_values(function="mean"),
+    keepdims=st.booleans(),
+)
+def test_paddle_mean(
+    *,
+    dtype_and_x,
+    keepdims,
+    on_device,
+    fn_tree,
+    frontend,
+    test_flags,
+):
+    input_dtype, x, axis = 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,
+        input=x[0],
+        axis=axis,
+        keepdims=keepdims,
+    )
Repository: ivy-llc/ivy

Issue:
while_loop



Discussion:

Resolving patch:
diff --git a/ivy/functional/frontends/tensorflow/general_functions.py b/ivy/functional/frontends/tensorflow/general_functions.py
--- a/ivy/functional/frontends/tensorflow/general_functions.py
+++ b/ivy/functional/frontends/tensorflow/general_functions.py
@@ -511,3 +511,18 @@ def unique(x, out_idx=ivy.int32, name=None):
     y = ret[0]
     idx = ivy.astype(ret[2], out_idx)
     return y, idx
+
+
+@to_ivy_arrays_and_back
+def while_loop(
+    cond,
+    body,
+    loop_vars,
+    shape_invariants=None,
+    parallel_iterations=10,
+    back_prop=True,
+    swap_memory=False,
+    maximum_iterations=None,
+    name=None,
+):
+    return ivy.while_loop(test_fn=cond, body_fn=body, vars=loop_vars)


Test patch:
diff --git a/ivy_tests/test_ivy/test_frontends/test_tensorflow/test_general_functions.py b/ivy_tests/test_ivy/test_frontends/test_tensorflow/test_general_functions.py
--- a/ivy_tests/test_ivy/test_frontends/test_tensorflow/test_general_functions.py
+++ b/ivy_tests/test_ivy/test_frontends/test_tensorflow/test_general_functions.py
@@ -1931,3 +1931,55 @@ def test_tensorflow_unique(
         fn_tree=fn_tree,
         on_device=on_device,
     )
+
+
+@handle_frontend_test(
+    fn_tree="tensorflow.while_loop",
+    dtype_and_x=helpers.dtype_and_values(
+        num_arrays=1,
+        min_num_dims=1,
+        max_num_dims=3,
+        min_dim_size=2,
+        max_dim_size=10,
+        shared_dtype=True,
+        min_value=-100,
+        max_value=100,
+        available_dtypes=helpers.get_dtypes("numeric"),
+    ),
+)
+def test_tensorflow_while_loop(
+    *,
+    dtype_and_x,
+    test_flags,
+    on_device,
+    fn_tree,
+    frontend,
+):
+    def _test_cond_fn(x):
+        def any_negative_real(arr):
+            for elem in arr:
+                if isinstance(elem, (int, float)) and elem < 0:
+                    return True
+                elif isinstance(elem, complex):
+                    return False
+                elif isinstance(elem, (list, tuple)):
+                    if any_negative_real(elem):
+                        return True
+            return False
+
+        return any_negative_real(x)
+
+    def _test_body_fn(x):
+        return x + 1
+
+    input_dtype, x = dtype_and_x
+    helpers.test_frontend_function(
+        input_dtypes=input_dtype,
+        test_flags=test_flags,
+        frontend=frontend,
+        fn_tree=fn_tree,
+        on_device=on_device,
+        cond=_test_cond_fn,
+        body=_test_body_fn,
+        loop_vars=(x[0],),
+    )