def compress(
        self,
        condition: ndarray,
        axis: Any = None,
        out: ndarray | None = None,
    ) -> ndarray:
        """a.compress(self, condition, axis=None, out=None)

        Return selected slices of an array along given axis.

        Refer to :func:`cupynumeric.compress` for full documentation.

        See Also
        --------
        cupynumeric.compress : equivalent function

        Availability
        --------
        Multiple GPUs, Multiple CPUs

        """
        a = self
        try:
            if condition.ndim != 1:
                raise ValueError(
                    "Dimension mismatch: condition must be a 1D array"
                )
        except AttributeError:
            raise ValueError(
                "Dimension mismatch: condition must be a 1D array"
            )
        condition = _warn_and_convert(condition, np.dtype(bool))

        if axis is None:
            axis = 0
            a = self.ravel()
        else:
            axis = normalize_axis_index(axis, self.ndim)

        if a.shape[axis] < condition.shape[0]:
            raise ValueError(
                "Shape mismatch: "
                "condition contains entries that are out of bounds"
            )
        elif a.shape[axis] > condition.shape[0]:
            slice_tuple = tuple(slice(None) for ax in range(axis)) + (
                slice(0, condition.shape[0]),
            )
            a = a[slice_tuple]

        index_tuple: tuple[Any, ...] = tuple(slice(None) for ax in range(axis))
        index_tuple += (condition,)

        if out is not None:
            out[:] = a[index_tuple]
            return out
        else:
            res = a[index_tuple]
            return res
a.compress(self, condition, axis=None, out=None)

        Return selected slices of an array along given axis.

        Refer to :func:`cupynumeric.compress` for full documentation.

        See Also
        --------
        cupynumeric.compress : equivalent function

        Availability
        --------
        Multiple GPUs, Multiple CPUs

        
cupynumeric/_array/array.py