Repository: ivy-llc/ivy

Issue:
Fix truth_value_testing.test_numpy_all
|   |   |
|---|---|
|numpy|<a href="https://github.com/unifyai/ivy/actions/runs/6302223306/job/17108957946"><img src=https://img.shields.io/badge/-success-success></a>
|jax|<a href="https://github.com/unifyai/ivy/actions/runs/6302223306/job/17108957946"><img src=https://img.shields.io/badge/-success-success></a>
|tensorflow|<a href="https://github.com/unifyai/ivy/actions/runs/6302223306/job/17108957946"><img src=https://img.shields.io/badge/-success-success></a>
|torch|<a href="https://github.com/unifyai/ivy/actions/runs/6408417944"><img src=https://img.shields.io/badge/-failure-red></a>
|paddle|<a href="https://github.com/unifyai/ivy/actions/runs/6302223306/job/17108957946"><img src=https://img.shields.io/badge/-success-success></a>



Discussion:

Resolving patch:
diff --git a/ivy/functional/frontends/numpy/ndarray/ndarray.py b/ivy/functional/frontends/numpy/ndarray/ndarray.py
--- a/ivy/functional/frontends/numpy/ndarray/ndarray.py
+++ b/ivy/functional/frontends/numpy/ndarray/ndarray.py
@@ -249,10 +249,20 @@ def transpose(self, axes, /):
     def swapaxes(self, axis1, axis2, /):
         return np_frontend.swapaxes(self, axis1, axis2)
 
-    def all(self, axis=None, out=None, keepdims=False, *, where=True):
+    def all(self, axis=None, dtype=None, out=None, keepdims=False, *, where=True):
+        if not (dtype is None or ivy.is_bool_dtype(dtype)):
+            raise TypeError(
+                "No loop matching the specified signature and "
+                "casting was found for ufunc logical_or"
+            )
         return np_frontend.all(self, axis, out, keepdims, where=where)
 
-    def any(self, axis=None, out=None, keepdims=False, *, where=True):
+    def any(self, axis=None, dtype=None, out=None, keepdims=False, *, where=True):
+        if not (dtype is None or ivy.is_bool_dtype(dtype)):
+            raise TypeError(
+                "No loop matching the specified signature and "
+                "casting was found for ufunc logical_or"
+            )
         return np_frontend.any(self, axis, out, keepdims, where=where)
 
     def argsort(self, *, axis=-1, kind=None, order=None):


Test patch:
diff --git a/ivy/functional/frontends/numpy/logic/truth_value_testing.py b/ivy/functional/frontends/numpy/logic/truth_value_testing.py
--- a/ivy/functional/frontends/numpy/logic/truth_value_testing.py
+++ b/ivy/functional/frontends/numpy/logic/truth_value_testing.py
@@ -21,9 +21,9 @@ def all(
     where=None,
 ):
     axis = tuple(axis) if isinstance(axis, list) else axis
+    if where is not None:
+        a = ivy.where(where, a, True)
     ret = ivy.all(a, axis=axis, keepdims=keepdims, out=out)
-    if ivy.is_array(where):
-        ret = ivy.where(where, ret, ivy.default(out, ivy.zeros_like(ret)), out=out)
     return ret
 
 
@@ -39,9 +39,9 @@ def any(
     where=None,
 ):
     axis = tuple(axis) if isinstance(axis, list) else axis
+    if where is not None:
+        a = ivy.where(where, a, False)
     ret = ivy.any(a, axis=axis, keepdims=keepdims, out=out)
-    if ivy.is_array(where):
-        ret = ivy.where(where, ret, ivy.default(out, ivy.zeros_like(ret)), out=out)
     return ret
 
 
diff --git a/ivy_tests/test_ivy/test_frontends/test_numpy/test_ndarray/test_ndarray.py b/ivy_tests/test_ivy/test_frontends/test_numpy/test_ndarray/test_ndarray.py
--- a/ivy_tests/test_ivy/test_frontends/test_numpy/test_ndarray/test_ndarray.py
+++ b/ivy_tests/test_ivy/test_frontends/test_numpy/test_ndarray/test_ndarray.py
@@ -443,26 +443,27 @@ def test_numpy_any(
     frontend,
     on_device,
 ):
-    input_dtypes, x, axis = dtype_x_axis
+    init_input_dtypes, x, axis = dtype_x_axis
     (
         where,
-        input_dtypes,
+        method_input_dtypes,
         method_flags,
     ) = np_frontend_helpers.handle_where_and_array_bools(
         where=[where[0][0]] if isinstance(where, list) else where,
-        input_dtype=input_dtypes,
+        input_dtype=init_input_dtypes,
         test_flags=method_flags,
     )
 
     helpers.test_frontend_method(
-        init_input_dtypes=input_dtypes,
+        init_input_dtypes=init_input_dtypes,
         backend_to_test=backend_fw,
         init_all_as_kwargs_np={
             "object": x[0],
         },
-        method_input_dtypes=input_dtypes,
+        method_input_dtypes=method_input_dtypes[1:],
         method_all_as_kwargs_np={
             "axis": axis,
+            "dtype": bool,
             "out": None,
             "keepdims": keepdims,
             "where": where,
@@ -502,26 +503,27 @@ def test_numpy_all(
     frontend,
     on_device,
 ):
-    input_dtypes, x, axis = dtype_x_axis
+    init_input_dtypes, x, axis = dtype_x_axis
     (
         where,
-        input_dtypes,
+        method_input_dtypes,
         method_flags,
     ) = np_frontend_helpers.handle_where_and_array_bools(
         where=[where[0][0]] if isinstance(where, list) else where,
-        input_dtype=input_dtypes,
+        input_dtype=init_input_dtypes,
         test_flags=method_flags,
     )
 
     helpers.test_frontend_method(
-        init_input_dtypes=input_dtypes,
+        init_input_dtypes=init_input_dtypes,
         backend_to_test=backend_fw,
         init_all_as_kwargs_np={
             "object": x[0],
         },
-        method_input_dtypes=input_dtypes,
+        method_input_dtypes=method_input_dtypes[1:],
         method_all_as_kwargs_np={
             "axis": axis,
+            "dtype": bool,
             "out": None,
             "keepdims": keepdims,
             "where": where,