code: def find_source_offsets(offsets_map, input_offsets, name=None):
      """Maps the input post-normalized string offsets to pre-normalized offsets.
  
      Returns the source (i.e. pre-normalized) string offsets mapped from the input
      post-normalized string offsets using the input offsets_map, which is an output
      from the `normalize_utf8_with_offsets_map` op. offsets_map can be indexed or
      sliced along with the input_offsets.
  
      #### Examples:
  
      >>> # input: <string>[num_strings]
      >>> post_normalized_str, offsets_map = normalize_utf8_with_offsets_map(
      ...     ["株式会社", "ＫＡＤＯＫＡＷＡ"])
      >>> # input: <variant>[num_strings], <int64>[num_strings, num_offsets]
      >>> find_source_offsets(offsets_map, [[0, 1, 2], [0, 1, 2]])
      >>> # output: <int64>[num_strings, num_offsets]
      <tf.Tensor: shape=(2, 3), dtype=int64, numpy=array([[0, 1, 2], [0, 3, 6]])>
      >>> # Offsets map can be indexed.
      >>> find_source_offsets(offsets_map[1], [[0, 1, 2]])
      <tf.Tensor: shape=(1, 3), dtype=int64, numpy=array([[0, 3, 6]])>
  
      Args:
        offsets_map: A `Tensor` or `RaggedTensor` of type `variant`, used to map the
          post-normalized string offsets to pre-normalized string offsets.
          offsets_map is an output from `normalize_utf8_with_offsets_map` function.
        input_offsets: A `Tensor` or `RaggedTensor` of type int64 representing the
          the post-normalized string offsets,
        name: The name for this op (optional).
  
      Returns:
        results: A `Tensor` or `RaggedTensor` of type int64, with pre-normalized
          string offsets.
      """
  
      with ops.name_scope(
          name, "FindSourceOffsets", [offsets_map, input_offsets]
      ):
          offsets_map_tensor = (
              ragged_tensor.convert_to_tensor_or_ragged_tensor(
                  offsets_map, dtype=dtypes.variant
              )
          )
          input_offsets_tensor = (
              ragged_tensor.convert_to_tensor_or_ragged_tensor(
                  input_offsets, dtype=dtypes.int64
              )
          )
  
          if ragged_tensor.is_ragged(input_offsets_tensor):
              if ragged_tensor.is_ragged(offsets_map_tensor):
                  offsets_map_values = offsets_map_tensor.flat_values
              else:
                  offsets_map_values = array_ops.reshape(
                      offsets_map_tensor, [-1]
                  )
  
              output_values = gen_normalize_ops.find_source_offsets(
                  offsets_map=offsets_map_values,
                  input_offsets_values=input_offsets_tensor.flat_values,
                  input_offsets_splits=input_offsets_tensor.nested_row_splits[
                      -1
                  ],
              )
              return input_offsets_tensor.with_flat_values(
                  output_values
              )
          else:
              if input_offsets_tensor.shape.ndims > 1:
                  output_offsets = find_source_offsets(
                      offsets_map,
                      ragged_conversion_ops.from_tensor(
                          input_offsets_tensor,
                          ragged_rank=input_offsets_tensor.shape.ndims
                          - 1,
                      ),
                  )
                  return ragged_conversion_ops.to_tensor(output_offsets)
              elif input_offsets_tensor.shape.ndims == 0:
                  output_offsets = find_source_offsets(
                      offsets_map,
                      array_ops.expand_dims(input_offsets_tensor, 0),
                  )
                  return output_offsets[0]
              else:
                  output_offsets = find_source_offsets(
                      offsets_map,
                      array_ops.expand_dims(input_offsets_tensor, 0),
                  )
                  return array_ops.squeeze(output_offsets, [0])
  
file_path: text/tensorflow_text/python/ops/normalize_ops.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import ops
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops.ragged import ragged_conversion_ops
  from tensorflow.python.ops.ragged import ragged_tensor
  from tensorflow.python.framework import load_library
  from tensorflow.python.platform import resource_loader
label_desc: Use image node_id 4 for calling a global function with example usage: find_source_offsets(offsets_map, input_offsets, name) and returns: input_offsets_tensor, ragged_conversion_ops, output_offsets, array_ops