cunumeric.nanmax#

cunumeric.nanmax(a: ndarray, axis: Any = None, out: ndarray | None = None, keepdims: bool = False, initial: int | float | None = None, where: ndarray | None = None) ndarray#

Return the maximum of an array or maximum along an axis, ignoring any NaNs. When all-NaN slices are encountered, a NaN is returned for that slice only when CUNUMERIC_NUMPY_COMPATIBILITY environment variable is set, otherwise identity is returned. Empty slices will raise a ValueError

Parameters:
  • a (array_like) – Array containing numbers whose maximum is desired. If a is not an array, a conversion is attempted.

  • axis (None or int or tuple[int], optional) –

    Axis or axes along which to operate. By default, flattened input is used.

    If this is a tuple of ints, the maximum is selected over multiple axes, instead of a single axis or all the axes as before.

  • out (ndarray, optional) – Alternative output array in which to place the result. Must be of the same shape and buffer length as the expected output. See ufuncs-output-type for more details.

  • keepdims (bool, optional) –

    If this is set to True, the axes which are reduced are left in the result as dimensions with size one. With this option, the result will broadcast correctly against the input array.

    If the default value is passed, then keepdims will not be passed through to the amax method of sub-classes of ndarray, however any non-default value will be. If the sub-class’ method does not implement keepdims any exceptions will be raised.

  • initial (scalar, optional) – The minimum value of an output element. Must be present to allow computation on empty slice. See ~cunumeric.ufunc.reduce for details.

  • where (array_like[bool], optional) – Elements to compare for the maximum. See ~cunumeric.ufunc.reduce for details.

Returns:

nanmax – An array with the same shape as a, with the specified axis removed. If a is 0-d array, of if axis is None, an ndarray scalar is returned. The same dtype as a is returned.

Return type:

ndarray or scalar

Notes

CuNumeric’s implementation will not raise a Runtime Warning for slices with all-NaNs

Availability:

Multiple GPUs, Multiple CPUs