code: def cumprod(
      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:
          dtype = _infer_dtype(x.dtype)
  
      if not (exclusive or reverse):
          return torch.cumprod(x, axis, dtype=dtype, out=out)
      elif exclusive and reverse:
          x = torch.cumprod(
              torch.flip(x, dims=(axis,)), axis, dtype=dtype
          )
          x = torch.transpose(x, axis, -1)
          x = torch.concat(
              (torch.ones_like(x[..., -1:]), x[..., :-1]), -1
          )
          x = torch.transpose(x, axis, -1)
          ret = torch.flip(x, dims=(axis,))
      elif exclusive:
          x = torch.transpose(x, axis, -1)
          x = torch.cat((torch.ones_like(x[..., -1:]), x[..., :-1]), -1)
          x = torch.cumprod(x, -1, dtype=dtype)
          ret = torch.transpose(x, axis, -1)
      else:
          x = torch.cumprod(
              torch.flip(x, dims=(axis,)), axis, dtype=dtype
          )
          ret = torch.flip(x, dims=(axis,))
      if ivy.exists(out):
          return ivy.inplace_update(out, ret)
      return ret
  
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 9 for calling a global function with example usage: cumprod() and returns: ret, torch, ivy