code: def count_nonzero(
      a: np.ndarray,
      /,
      *,
      axis: Optional[Union[int, Tuple[int, ...]]] = None,
      keepdims: bool = False,
      dtype: Optional[np.dtype] = None,
      out: Optional[np.ndarray] = None,
  ) -> np.ndarray:
      if isinstance(axis, list):
          axis = tuple(axis)
      ret = np.count_nonzero(a, axis=axis, keepdims=keepdims)
      if np.isscalar(ret):
          return np.array(ret, dtype=dtype)
      return ret.astype(dtype)
  
imports: from typing import Optional, Union, Tuple, List, Sequence
  import numpy
  import numpy.typing
  import ivy
  from ivy import promote_types_of_inputs
  from ivy.functional.backends.numpy.helpers import _scalar_output_to_0d_array
  from ivy.func_wrapper import with_unsupported_dtypes
  from .None import backend_version
label_desc: Use image node_id 7 for calling a global function with example usage: count_nonzero() and returns: ret, np