code: def __find_cummax_indices(
      x: np.ndarray,
      axis: int = 0,
  ) -> np.ndarray:
      indices = []
      if x[0] is np.ndarray:
          if axis >= 1:
              for ret1 in x:
                  indice = __find_cummax_indices(ret1, axis=axis - 1)
                  indices.append(indice)
  
          else:
              indice_list = __get_index(x.tolist())
              indices, n1 = x.copy(), {}
              indices.fill(0)
              indice_list = sorted(indice_list, key=lambda i: i[1])
              for y, y_index in indice_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]
                  elif (
                      y
                      >= x[
                          tuple(
                              [n1[tuple(multi_index[1:])]]
                              + list(multi_index[1:])
                          )
                      ]
                  ):
                      n1[tuple(multi_index[1:])] = multi_index[0]
                      indices[y_index] = multi_index[0]
                  else:
                      indices[y_index] = n1[tuple(multi_index[1:])]
      else:
          n = 0
          for index1, ret1 in enumerate(x):
              if x[n] <= ret1 or index1 == 0:
                  n = index1
              indices.append(n)
      return np.array(indices, dtype=np.int64)
  
imports: from typing import Optional, Union, Tuple, Sequence
  import numpy
  import math
  import ivy
  from ivy.func_wrapper import with_unsupported_dtypes
  from .None import backend_version
  from ..statistical import _infer_dtype
  from copy import deepcopy
label_desc: Use image node_id 17 for calling a global function with example usage: __find_cummax_indices(x, axis) and returns: np