code: def top_k_with_unique(inputs, k):
      """Finds the values and indices of the k largests entries.
  
      Instead of doing sort like tf.nn.top_k, this function finds the max value
      k times. The running time is proportional to k, which is be faster when k
      is small. The current implementation supports only inputs of rank 2.
      In addition, iota is used to replace the lower bits of each element, this
      makes the selection more stable when there are equal elements. The
      overhead is that output values are approximated.
  
      Args:
        inputs: A tensor with rank of 2. [batch_size, original_size].
        k: An integer, number of top elements to select.
  
      Returns:
        top_values: A tensor, the k largest elements in sorted order.
          [batch_size, k].
        indices: A tensor, indices of the top_values. [batch_size, k].
      """
      unique_inputs = _create_make_unique(tf.cast(inputs, tf.float32))
      top_values, indices = _create_topk_unique(unique_inputs, k)
      top_values = tf.cast(top_values, inputs.dtype)
      return top_values, indices
  
file_path: finetune/finetune/util/beam_search.py
imports: import math
  import numpy
  from finetune.util.shapes import shape_list
  import tensorflow
  from tensorflow.python.ops import inplace_ops
  from tensorflow.python.util import nest
label_desc: Use image node_id 11 for calling a global function with example usage: top_k_with_unique(inputs, k) and returns: top_values,  indices