code: def _get_selected_item_positions(item_selector, input_ids, axis=1):
      """Get the positions of the items that have been selected.
  
      Args:
        item_selector: an instance of `ItemSelector`.
        input_ids: a `RaggedTensor` with n dimensions, whose items will be
          selected on.
        axis: (optional) An int detailing the dimension to apply selection on.
          Default is the 1st dimension.
  
      Returns:
        A `RaggedTensor` of int64s, with rank 2, shape
       [batch, (num_selections)] and whose values are the positions of items
       that have been selected.
      """
      original_input_ids = input_ids
  
      # select items for masking
      selected_for_mask = item_selector.get_selection_mask(
          input_ids, axis
      )
  
      # create a positions RT
      original_input_ids = (
          original_input_ids.merge_dims(1, -1)
          if original_input_ids.ragged_rank > 1
          else original_input_ids
      )
      positions = ragged_math_ops.range(
          original_input_ids.row_lengths()
      )
      positions = input_ids.with_flat_values(positions.flat_values)
  
      # drop out not-masked positions
      results = ragged_array_ops.boolean_mask(
          positions, selected_for_mask
      )
      results = (
          results.merge_dims(1, -1)
          if results.ragged_rank > 1
          else results
      )
      return results
  
imports: from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import ops
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import control_flow_assert
  from tensorflow.python.ops import math_ops
  from tensorflow.python.ops import random_ops
  from tensorflow.python.ops.ragged import ragged_array_ops
  from tensorflow.python.ops.ragged import ragged_math_ops
  from tensorflow.python.ops.ragged import ragged_tensor
  from tensorflow.python.ops.ragged import ragged_where_op
  from tensorflow_text.python.ops import item_selector_ops
label_desc: Use image node_id 3 for calling a global function with example usage: _get_selected_item_positions(item_selector, input_ids, axis) and returns: results