MCPcopy Create free account
hub / github.com/numpy/numpy / all

Function all

numpy/core/fromnumeric.py:2422–2505  ·  view source on GitHub ↗

Test whether all array elements along a given axis evaluate to True. Parameters ---------- a : array_like Input array or object that can be converted to an array. axis : None or int or tuple of ints, optional Axis or axes along which a logical AND reduction is p

(a, axis=None, out=None, keepdims=np._NoValue, *, where=np._NoValue)

Source from the content-addressed store, hash-verified

2420
2421@array_function_dispatch(_all_dispatcher)
2422def all(a, axis=None, out=None, keepdims=np._NoValue, *, where=np._NoValue):
2423 """
2424 Test whether all array elements along a given axis evaluate to True.
2425
2426 Parameters
2427 ----------
2428 a : array_like
2429 Input array or object that can be converted to an array.
2430 axis : None or int or tuple of ints, optional
2431 Axis or axes along which a logical AND reduction is performed.
2432 The default (``axis=None``) is to perform a logical AND over all
2433 the dimensions of the input array. `axis` may be negative, in
2434 which case it counts from the last to the first axis.
2435
2436 .. versionadded:: 1.7.0
2437
2438 If this is a tuple of ints, a reduction is performed on multiple
2439 axes, instead of a single axis or all the axes as before.
2440 out : ndarray, optional
2441 Alternate output array in which to place the result.
2442 It must have the same shape as the expected output and its
2443 type is preserved (e.g., if ``dtype(out)`` is float, the result
2444 will consist of 0.0's and 1.0's). See :ref:`ufuncs-output-type` for more
2445 details.
2446
2447 keepdims : bool, optional
2448 If this is set to True, the axes which are reduced are left
2449 in the result as dimensions with size one. With this option,
2450 the result will broadcast correctly against the input array.
2451
2452 If the default value is passed, then `keepdims` will not be
2453 passed through to the `all` method of sub-classes of
2454 `ndarray`, however any non-default value will be. If the
2455 sub-class' method does not implement `keepdims` any
2456 exceptions will be raised.
2457
2458 where : array_like of bool, optional
2459 Elements to include in checking for all `True` values.
2460 See `~numpy.ufunc.reduce` for details.
2461
2462 .. versionadded:: 1.20.0
2463
2464 Returns
2465 -------
2466 all : ndarray, bool
2467 A new boolean or array is returned unless `out` is specified,
2468 in which case a reference to `out` is returned.
2469
2470 See Also
2471 --------
2472 ndarray.all : equivalent method
2473
2474 any : Test whether any element along a given axis evaluates to True.
2475
2476 Notes
2477 -----
2478 Not a Number (NaN), positive infinity and negative infinity
2479 evaluate to `True` because these are not equal to zero.

Callers 15

test_iter_op_axesFunction · 0.90
eigvalsFunction · 0.90
eigFunction · 0.90
matrix_rankFunction · 0.90
assert_array_compareFunction · 0.90
_block_slicingFunction · 0.70
einsumFunction · 0.70
alltrueFunction · 0.70
allcloseFunction · 0.70
iscloseFunction · 0.70
build_projectFunction · 0.50

Calls 1

_wrapreductionFunction · 0.85

Tested by 15

test_iter_op_axesFunction · 0.72
build_projectFunction · 0.40
test_featuresMethod · 0.40
test_diophantine_fuzzFunction · 0.40
checkFunction · 0.40
__array_function__Method · 0.40
test_reduceMethod · 0.40
test_refcountingMethod · 0.40