Returns elements that break the monotonically non-decreasing trend.

  This is used to find instances of global step values that are "out-of-order",
  which may trigger TensorBoard event discarding logic.

  Args:
    list_of_numbers: A list of numbers.

  Returns:
    A list of tuples in which each tuple are two elements are adjacent, but the
    second element is lower than the first.

def get_out_of_order(list_of_numbers):
  """Returns elements that break the monotonically non-decreasing trend.

  This is used to find instances of global step values that are "out-of-order",
  which may trigger TensorBoard event discarding logic.

  Args:
    list_of_numbers: A list of numbers.

  Returns:
    A list of tuples in which each tuple are two elements are adjacent, but the
    second element is lower than the first.
  """
  # TODO: Consider changing this to only check for out-of-order
  # steps within a particular tag.
  result = []
  # pylint: disable=consider-using-enumerate
  for i in range(len(list_of_numbers)):
    if i == 0:
      continue
    if list_of_numbers[i] < list_of_numbers[i - 1]:
      result.append((list_of_numbers[i - 1], list_of_numbers[i]))
  return result