code: def cumsum(
      x: Union[ivy.Array, ivy.NativeArray],
      axis: int = 0,
      exclusive: bool = False,
      reverse: bool = False,
      *,
      dtype: Optional[Union[ivy.Dtype, ivy.NativeDtype]] = None,
      out: Optional[ivy.Array] = None,
  ) -> ivy.Array:
      """Return the cumulative sum of the elements along a given axis.
  
      Parameters
      ----------
      x
          Input array.
      axis
          Axis along which the cumulative sum is computed. Default is ``0``.
      exclusive
          Whether to perform cumsum exclusively. Default is ``False``.
      reverse
          Whether to perform the cumsum from last to first element in the selected
          axis. Default is ``False`` (from first to last element)
      dtype
          Data type of the returned array. Default is ``None``.
          If None, if the default data type corresponding to the data type “kind”
          (integer or floating-point) of x has a smaller range of values than the
          data type of x (e.g., x has data type int64 and the default data type
          is int32, or x has data type uint64 and the default data type is int64),
          the returned array must have the same data type as x.
          If x has a floating-point data type, the returned array must have the
          default floating-point data type.
          If x has a signed integer data type (e.g., int16), the returned array
          must have the default integer data type.
          If x has an unsigned integer data type (e.g., uint16), the returned
          array must have an unsigned integer data type having the same number of
          bits as the default integer data type (e.g., if the default integer data
          type is int32, the returned array must have a uint32 data type).
          If the data type (either specified or resolved) differs from the data type
          of x, the input array should be cast to the specified data type before
          computing the product.
      out
          Optional output array, for writing the result to. It must have a shape that the
          inputs broadcast to.
  
      Returns
      -------
      ret
          Array which holds the result of applying cumsum at each
          original array elements along the specified axis.
  
      Examples
      --------
      With :class:`ivy.Array` input:
  
      >>> x = ivy.array([1, 5, 2, 0])
      >>> y = ivy.cumsum(x, exclusive= True, reverse=False)
      >>> print(y)
      ivy.array([0, 1, 6, 8])
  
      >>> x = ivy.array([[6, 4, 2],
      ...                [1, 3, 0]])
      >>> y = ivy.zeros((2,3))
      >>> ivy.cumsum(x, axis=0, exclusive=False, reverse=True, out=y)
      >>> print(y)
      ivy.array([[7, 7, 2],
                 [1, 3, 0]])
  
      >>> x = ivy.array([[1, 5, 2],
      ...                [4, 3, 0]])
      >>> y = ivy.cumsum(x, axis=0, exclusive=True, reverse=True)
      >>> print(y)
      ivy.array([[4, 3, 0],
                 [0, 0, 0]])
  
      >>> x = ivy.array([[2, 4, 5],
      ...                [3, 6, 5],
      ...                [1, 3, 10]])
      >>> ivy.cumsum(x,axis=1,reverse=True, dtype='int64', out=x)
      >>> print(x)
      ivy.array([[11,  9,  5],
                 [14, 11,  5],
                 [14, 13, 10]])
  
      With :class:`ivy.Container` input:
  
      >>> x = ivy.Container(a=ivy.array([[1, 3, 5]]),
      ...                   b=ivy.array([[3, 5, 7]]))
      >>> y = ivy.cumsum(x, axis= 0)
      >>> print(y)
      {
          a: ivy.array([[1, 3, 5]]),
          b: ivy.array([[3, 5, 7]])
      }
  
      >>> x = ivy.Container(a=ivy.array([[1, 3, 4]]),
      ...                   b=ivy.array([[3, 5, 8],
      ...                                [5, 6, 5]]),
      ...                   c=ivy.array([[2, 4, 1],
      ...                                [3, 6, 9],
      ...                                [0, 2, 3]]))
      >>> y = ivy.Container(a = ivy.zeros((1, 3)),
      ...                   b = ivy.zeros((2, 3)),
      ...                   c = ivy.zeros((3,3)))
      >>> ivy.cumsum(x,axis=1,reverse=True, out=y)
      >>> print(y)
      {
          a: ivy.array([[8, 7, 4]]),
          b: ivy.array([[16, 13, 8],
                        [16, 11, 5]]),
          c: ivy.array([[7, 5, 1],
                        [18, 15, 9],
                        [5, 5, 3]])
      }
  
      >>> x = ivy.Container(a=ivy.array([[0],
      ...                                [5]]),
      ...                   b=ivy.array([[6, 8, 7],
      ...                                [4, 2, 3]]),
      ...                   c=ivy.array([[1, 2],
      ...                                [3, 4],
      ...                                [6, 4]]))
      >>> ivy.cumsum(x,axis=0,out=x)
      >>> print(x)
      {
          a: ivy.array([[0],
                        [5]]),
          b: ivy.array([[6, 8, 7],
                        [10, 10, 10]]),
          c: ivy.array([[1, 2],
                        [4, 6],
                        [10, 10]])
      }
      """
      return current_backend(x).cumsum(
          x, axis, exclusive, reverse, dtype=dtype, out=out
      )
  
file_path: ivy/ivy/functional/ivy/statistical.py
imports: from typing import Union, Optional, Sequence
  import ivy
  from ivy.utils.backend import current_backend
  from ivy.func_wrapper import handle_array_function, to_native_arrays_and_back, handle_out_argument, handle_nestable, handle_array_like_without_promotion, handle_device, handle_backend_invalid
  from ivy.utils.exceptions import handle_exceptions
label_desc: Use image node_id 9 for calling a global function with example usage: cumsum(x, axis, exclusive, reverse) and returns: current_backend