code: def __find_cummax(
      x: paddle.Tensor,
      axis: int = 0,
      dtype: Optional[paddle.dtype] = None,
  ) -> Tuple[paddle.Tensor, paddle.Tensor]:
      indices = []
      values = []
      x_dtype = x.dtype if dtype is None else dtype
      if (
          isinstance(x.tolist()[0], list)
          and len(x[0].shape) >= 1
          and (isinstance(x[0], (paddle.Tensor, ivy.Array)))
      ):
          if axis >= 1:
              if not isinstance(x, list):
                  x = x.tolist()
              for ret1 in x:
                  value, indice = __find_cummax(
                      paddle.to_tensor(ret1, dtype=x_dtype),
                      axis=axis - 1,
                      dtype=x_dtype,
                  )
                  indices.append(indice)
                  values.append(value)
          else:
              x_list = x.numpy()
              z_list = __get_index(x_list.tolist())
              indices, values, n1 = x_list.copy(), x_list.copy(), {}
              indices.fill(0)
              values.fill(0)
              z_list = sorted(z_list, key=lambda i: i[1])
              for y, y_index in z_list:
                  multi_index = y_index
                  if tuple(multi_index[1:]) not in n1:
                      n1[tuple(multi_index[1:])] = multi_index[0]
                      indices[y_index] = multi_index[0]
                      values[y_index] = y
                  elif (
                      y
                      >= x_list[
                          tuple(
                              [n1[tuple(multi_index[1:])]]
                              + list(multi_index[1:])
                          )
                      ]
                  ):
                      n1[tuple(multi_index[1:])] = multi_index[0]
                      indices[y_index] = multi_index[0]
                      values[y_index] = y
                  else:
                      indices[y_index] = n1[tuple(multi_index[1:])]
                      values[y_index] = x_list[
                          tuple(
                              [n1[tuple(multi_index[1:])]]
                              + list(multi_index[1:])
                          )
                      ]
      else:
          if not isinstance(x, list):
              x = x.tolist()
          n = 0
          for idx, y in enumerate(x):
              if x[n] > y:
                  values.append(x[n])
              elif x[n] <= y or idx == 0:
                  n = idx
                  values.append(y)
              indices.append(n)
  
      if isinstance(x, paddle.Tensor):
          return paddle.to_tensor(
              values, dtype=x.dtype
          ), paddle.to_tensor(indices, dtype="int64")
      else:
          return ivy.array(values, dtype=x_dtype), ivy.array(
              indices, dtype="int64"
          )
  
imports: from typing import Optional, Union, Tuple, Sequence, Any
  import paddle
  import ivy.functional.backends.paddle
  import ivy
  from copy import deepcopy
  from ivy.func_wrapper import with_unsupported_device_and_dtypes, with_supported_dtypes
  from .None import backend_version
label_desc: Use image node_id 20 for calling a global function with example usage: __find_cummax(x, axis, dtype) and returns: paddle,  paddle, ivy,  ivy