mlx.core.count_nonzero# count_nonzero(a: array, /, *, axis: None | int | Sequence[int] = None, keepdims: bool = False, stream: None | Stream | Device = None) → array# Count the number of non-zero elements along the given axis. Parameters: a (array) – Input array. axis (int or tuple(int), optional) – Axis or axes to count over. Defaults to None in which case the whole array is counted. keepdims (bool, optional) – Keep the reduced axes as size one. Default: False. Returns: The counts as an int32 array. Return type: array