code: def _ragged_type_to_spec(t):
      if isinstance(t, ragged_tensor.RaggedTensorType):
          # Note: need to adjust ragged_rank by 1, since RaggedTensorSpec gives the
          # type for the mapped `fn` output, but RaggedTensorType gives the type for
          # the result of stacking the mapped `fn` outputs.
          return ragged_tensor.RaggedTensorSpec(
              None, t.dtype, t.ragged_rank - 1, t.row_splits_dtype
          )
      else:
          return t
  
imports: from tensorflow.python.ops import map_fn
  from tensorflow.python.ops.ragged import ragged_tensor
  from tensorflow.python.util import nest
label_desc: Use image node_id 2 for calling a global function with example usage: _ragged_type_to_spec(t) and returns: ragged_tensor, t