code: def merge_cap_time_tokens(caption_tokens, timestamp_token, order):
      """Merge tensors of time and text tokens into a single tensor.
  
      Args:
        caption_tokens: Tensor of text tokens for each event.
        timestamp_token: Tensor of time tokens for each event.
        order: ld for time tokens first, dl for text tokens first.
  
      Returns:
        Tensor of text and time tokens for each event.
      """
  
      if order == "ld":
          seq = tf.concat(
              [
                  caption_tokens[:, :1],  # BOS
                  timestamp_token,  # timestamp
                  caption_tokens[:, 1:-2],
              ],  # caption
              axis=1,
          )
      else:
          seq = tf.concat(
              [
                  caption_tokens[:, :-2],  # caption
                  timestamp_token,
              ],  # timestamp
              axis=1,
          )
      return seq
  
imports: import functools
  from typing import Any, Mapping, Optional, Union
  from dmvr import builders
  from dmvr import processors
  from dmvr import tokenizers
  import gin
  from t5.data.preprocessors import DenoiseInputsFn
  from t5.data.preprocessors import DenoiseNoiseMaskFn
  from t5.data.preprocessors import DenoiseTargetsFn
  from t5.data.preprocessors import random_spans_noise_mask
  import tensorflow
label_desc: Use image node_id 2 for calling a global function with example usage: merge_cap_time_tokens(caption_tokens, timestamp_token, order) and returns: seq