code: def cumsum(
      x: np.ndarray,
      axis: int = 0,
      exclusive: bool = False,
      reverse: bool = False,
      *,
      dtype: Optional[np.dtype] = None,
      out: Optional[np.ndarray] = None,
  ) -> np.ndarray:
      if dtype is None:
          dtype = _infer_dtype(x.dtype)
  
      if exclusive or reverse:
          if exclusive and reverse:
              x = np.cumsum(
                  np.flip(x, axis=axis), axis=axis, dtype=dtype
              )
              x = np.swapaxes(x, axis, -1)
              x = np.concatenate(
                  (np.zeros_like(x[..., -1:]), x[..., :-1]), -1
              )
              x = np.swapaxes(x, axis, -1)
              res = np.flip(x, axis=axis)
          elif exclusive:
              x = np.swapaxes(x, axis, -1)
              x = np.concatenate(
                  (np.zeros_like(x[..., -1:]), x[..., :-1]), -1
              )
              x = np.cumsum(x, -1, dtype=dtype)
              res = np.swapaxes(x, axis, -1)
          elif reverse:
              x = np.cumsum(
                  np.flip(x, axis=axis), axis=axis, dtype=dtype
              )
              res = np.flip(x, axis=axis)
          return res
      return np.cumsum(x, axis, dtype=dtype, out=out)
  
file_path: ivy/ivy/functional/backends/numpy/statistical.py
imports: import numpy
  from typing import Union, Optional, Sequence
  import ivy
  from ivy.func_wrapper import with_unsupported_dtypes
  from ivy.functional.backends.numpy.helpers import _scalar_output_to_0d_array
  from .None import backend_version
  from ivy.utils.einsum_parser import legalise_einsum_expr
label_desc: Use image node_id 10 for calling a global function with example usage: cumsum(x, axis, exclusive, reverse) and returns: np, res