mlx.core.count_nonzero# count_nonzero(a: array, /, *, axis: None | int | Sequence[int] = None, keepdims: bool = False, stream: StreamOrDevice = None) → array# Count the number of non-zero elements along the given axis. 参数: 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. 返回: The counts as an int32 array. 返回类型: array