code: def unique_consecutive(
      x: JaxArray,
      /,
      *,
      axis: Optional[int] = None,
  ) -> Tuple[JaxArray, JaxArray, JaxArray]:
      Results = namedtuple(
          "Results",
          ["output", "inverse_indices", "counts"],
      )
      x_shape = None
      if axis is None:
          x_shape = x.shape
          x = x.flatten()
          axis = -1
      if axis < 0:
          axis += x.ndim
      sub_arrays = jnp.split(
          x,
          jnp.where(
              jnp.any(
                  jnp.diff(x, axis=axis) != 0,
                  axis=tuple(
                      i for i in jnp.arange(x.ndim) if i != axis
                  ),
              )
          )[0]
          + 1,
          axis=axis,
      )
      output = jnp.concatenate(
          [
              jnp.unique(sub_array, axis=axis)
              for sub_array in sub_arrays
          ],
          axis=axis,
      )
      counts = jnp.array(
          [sub_array.shape[axis] for sub_array in sub_arrays]
      )
      inverse_indices = jnp.repeat(jnp.arange(len(counts)), counts)
      if x_shape:
          inverse_indices = jnp.reshape(inverse_indices, x_shape)
      return Results(
          output.astype(x.dtype),
          inverse_indices,
          counts,
      )
  
imports: from typing import Iterable, Optional, Union, Sequence, Tuple, NamedTuple, Literal, Callable, Any, List
  import jax.numpy
  import jax.lax
  from numbers import Number
  from collections import namedtuple
  import ivy
  from ivy.functional.backends.jax import JaxArray
label_desc: Use image node_id 24 for calling a global function with example usage: unique_consecutive() and returns: Results