code: def __find_cummax(
      x: tf.Tensor, axis: int = 0
  ) -> Tuple[tf.Tensor, tf.Tensor]:
      values, indices = [], []
      if (
          isinstance(x[0], tf.Tensor)
          and isinstance(x[0].numpy().tolist(), list)
          and len(x[0].numpy().tolist()) >= 1
      ):
          if axis >= 1:
              for ret1 in x:
                  value, indice = __find_cummax(ret1, axis=axis - 1)
                  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:
          x_indices = tf.convert_to_tensor(
              list(range(0, x.shape[0])), dtype=x.dtype
          )
          values, indices = tf.scan(
              lambda a, b: (
                  a
                  if a > b
                  or tf.experimental.numpy.where(
                      x[0].numpy() == b[0].numpy()
                  )
                  == 0
                  else b
              ),
              (x, x_indices),
          )
  
      return tf.convert_to_tensor(values, dtype=x.dtype), tf.cast(
          tf.convert_to_tensor(indices), dtype=tf.int64
      )
  
imports: from typing import Union, Optional, Tuple, Sequence
  import tensorflow
  from tensorflow.python.ops.numpy_ops import np_math_ops
  import ivy
  from ivy import with_unsupported_dtypes, with_supported_dtypes, with_supported_device_and_dtypes
  from ..None import backend_version
  from copy import deepcopy
label_desc: Use image node_id 18 for calling a global function with example usage: __find_cummax(x, axis) and returns: tf,  tf