def amin(a, axis=None, out=None, keepdims=False): """Returns the minimum of an array or the minimum along an axis. .. note:: When at least one element is NaN, the corresponding min value will be NaN. Args: a (cupy.ndarray): Array to take the minimum. axis (int): Along which axis to take the minimum. The flattened array is used by default. out (cupy.ndarray): Output array. keepdims (bool): If ``True``, the axis is remained as an axis of size one. Returns: cupy.ndarray: The minimum of ``a``, along the axis if specified. .. seealso:: :func:`numpy.amin` """ if _fusion_thread_local.is_fusing(): if keepdims: raise NotImplementedError( 'cupy.amin does not support `keepdims` in fusion yet.') return _fusion_thread_local.call_reduction(_statistics.amin, a, axis=axis, out=out) # TODO(okuta): check type return a.min(axis=axis, out=out, keepdims=keepdims)
def sum(a, axis=None, dtype=None, out=None, keepdims=False): """Returns the sum of an array along given axes. Args: a (cupy.ndarray): Array to take sum. axis (int or sequence of ints): Axes along which the sum is taken. dtype: Data type specifier. out (cupy.ndarray): Output array. keepdims (bool): If ``True``, the specified axes are remained as axes of length one. Returns: cupy.ndarray: The result array. .. seealso:: :func:`numpy.sum` """ if _fusion_thread_local.is_fusing(): if keepdims: raise NotImplementedError( 'cupy.sum does not support `keepdims` in fusion yet.') if dtype is None: func = _math.sum_auto_dtype else: func = _math._sum_keep_dtype return _fusion_thread_local.call_reduction(func, a, axis=axis, dtype=dtype, out=out) # TODO(okuta): check type return a.sum(axis, dtype, out, keepdims)
def all(a, axis=None, out=None, keepdims=False): """Tests whether all array elements along a given axis evaluate to True. Args: a (cupy.ndarray): Input array. axis (int or tuple of ints): Along which axis to compute all. The flattened array is used by default. out (cupy.ndarray): Output array. keepdims (bool): If ``True``, the axis is remained as an axis of size one. Returns: cupy.ndarray: An array reduced of the input array along the axis. .. seealso:: :func:`numpy.all` """ if _fusion_thread_local.is_fusing(): if keepdims: raise NotImplementedError( 'cupy.all does not support `keepdims` in fusion yet.') return _fusion_thread_local.call_reduction( _logic.all, a, axis=axis, out=out) _util.check_array(a, arg_name='a') return a.all(axis=axis, out=out, keepdims=keepdims)