code: def count_nonzero(
      a: Union[ivy.Array, ivy.NativeArray],
      /,
      *,
      axis: Optional[Union[int, Tuple[int, ...]]] = None,
      keepdims: bool = False,
      dtype: Optional[Union[ivy.Dtype, ivy.NativeDtype]] = None,
      out: Optional[Union[ivy.Array, ivy.NativeArray]] = None,
  ) -> ivy.Array:
      """Count the number of non-zero values in the array a.
  
      Parameters
      ----------
      a
          array for which to count non-zeros.
      axis
          optional axis or tuple of axes along which to count non-zeros. Default is
          None, meaning that non-zeros will be counted along a flattened
          version of the input array.
      keepdims
          optional, if this is set to True, the axes that are counted are left in the
          result as dimensions with size one. With this option, the result
          will broadcast correctly against the input array.
      dtype
          optional output dtype. Default is of type integer.
      out
          optional output array, for writing the result to.
  
      Returns
      -------
      ret
          Number of non-zero values in the array along a given axis. Otherwise,
          the total number of non-zero values in the array is returned.
  
      Examples
      --------
      >>> a = ivy.array([[0, 1, 2, 3],[4, 5, 6, 7]])
      >>> ivy.count_nonzero(a)
      ivy.array(7)
      >>> a = ivy.array([[0, 1, 2, 3],[4, 5, 6, 7]])
      >>> ivy.count_nonzero(a, axis=0)
      ivy.array([1, 2, 2, 2])
      >>> a = ivy.array([[[0,1],[2,3]],[[4,5],[6,7]]])
      >>> ivy.count_nonzero(a, axis=(0,1), keepdims=True)
      ivy.array([[[3, 4]]])
      """
      return ivy.current_backend().count_nonzero(
          a, axis=axis, keepdims=keepdims, dtype=dtype, out=out
      )
  
imports: from typing import Optional, Union, Tuple, List, Sequence
  from numbers import Number
  import ivy
  from ivy.func_wrapper import handle_out_argument, to_native_arrays_and_back, handle_nestable, handle_partial_mixed_function, handle_array_like_without_promotion, inputs_to_ivy_arrays, handle_array_function, infer_dtype, handle_device, handle_backend_invalid
  from ivy.utils.exceptions import handle_exceptions
label_desc: Use image node_id 8 for calling a global function with example usage: count_nonzero() and returns: ivy