code: def cumsum(
      x: torch.Tensor,
      axis: int = 0,
      exclusive: bool = False,
      reverse: bool = False,
      *,
      dtype: Optional[torch.dtype] = None,
      out: Optional[torch.Tensor] = None,
  ) -> torch.Tensor:
      dtype = ivy.as_native_dtype(dtype)
      if dtype is None:
          if ivy.is_int_dtype(x.dtype):
              dtype = ivy.promote_types(
                  x.dtype, ivy.default_int_dtype(as_native=True)
              )
          dtype = _infer_dtype(x.dtype)
      if exclusive or reverse:
          if exclusive and reverse:
              x = torch.cumsum(
                  torch.flip(x, dims=(axis,)), axis, dtype=dtype
              )
              x = torch.transpose(x, axis, -1)
              x = torch.concat(
                  (torch.zeros_like(x[..., -1:]), x[..., :-1]), -1
              )
              x = torch.transpose(x, axis, -1)
              res = torch.flip(x, dims=(axis,))
          elif exclusive:
              x = torch.transpose(x, axis, -1)
              x = torch.cat(
                  (torch.zeros_like(x[..., -1:]), x[..., :-1]), -1
              )
              x = torch.cumsum(x, -1, dtype=dtype)
              res = torch.transpose(x, axis, -1)
          else:
              x = torch.cumsum(
                  torch.flip(x, dims=(axis,)), axis, dtype=dtype
              )
              res = torch.flip(x, dims=(axis,))
          if ivy.exists(out):
              return ivy.inplace_update(out, res)
          return res
      return torch.cumsum(x, axis, dtype=dtype, out=out)
  
file_path: ivy/ivy/functional/backends/torch/statistical.py
imports: from typing import Union, Optional, Sequence
  import torch
  import ivy
  from ivy.functional.ivy.statistical import _get_promoted_type_of_operands
  from ivy.func_wrapper import with_unsupported_dtypes, with_supported_dtypes
  from .None import backend_version
label_desc: Use image node_id 10 for calling a global function with example usage: cumsum(x, axis, exclusive, reverse) and returns: torch, res, ivy