class_docstr: Implements a video+text single-tower backbone.
  
  Attributes:
    num_classes: Number of output classes.
    video_tower_config: The config of the video tower.
    text_tower_config: The config of the text tower.
    video_text_fusion_config: The config of video+text fusion.
    classifier: 'gap' or 'token'
class_docstr_tok: ["Implements","a","video+text","single-tower","backbone",".","Attributes",":","num_classes",":","Number","of","output","classes",".","video_tower_config",":","The","config","of","the","video","tower",".","text_tower_config",":","The","config","of","the","text","tower",".","video_text_fusion_config",":","The","config","of","video+text","fusion",".","classifier",":","'gap","'","or","'token","'"]
docstr: Encodes video.
  
  We use a separate encoder to encode each modality and the output is obtained
  by concatenating encoded tokens in the channel dimension. We assume that
  all modality share the same sequence length.
  
  Args:
    inputs: Mappings from modality names to input data from each modality.
    train: Whether or not it is in training.
    debug: Whether or not it is in debug mode.
  
  Returns:
    A 3D float tensor of shape (batch, seq_length, channels) representing the
      concatenated encoded tokens.
docstr_tok: ["Encodes","video",".","We","use","a","separate","encoder","to","encode","each","modality","and","the","output","is","obtained","by","concatenating","encoded","tokens","in","the","channel","dimension",".","We","assume","that","all","modality","share","the","same","sequence","length",".","Args",":","inputs",":","Mappings","from","modality","names","to","input","data","from","each","modality",".","train",":","Whether","or","not","it","is","in","training",".","debug",":","Whether","or","not","it","is","in","debug","mode",".","Returns",":","A","3D","float","tensor","of","shape","(","batch",",","seq_length",",","channels",")","representing","the","concatenated","encoded","tokens","."]
code: def encode_video(
      self,
      inputs: Dict[str, Any],
      train: bool = False,
      debug: bool = False,
  ) -> jnp.ndarray:
      """Encodes video.
  
      We use a separate encoder to encode each modality and the output is obtained
      by concatenating encoded tokens in the channel dimension. We assume that
      all modality share the same sequence length.
  
      Args:
        inputs: Mappings from modality names to input data from each modality.
        train: Whether or not it is in training.
        debug: Whether or not it is in debug mode.
  
      Returns:
        A 3D float tensor of shape (batch, seq_length, channels) representing the
          concatenated encoded tokens.
      """
  
      if self.video_tower_config.get("modality_configs") is None:
          # Ensure backward compatibility.
          input_key = self.video_tower_config.get("input_key", "rgb")
          video_tokens = self.video_encoder(
              inputs[input_key], train=train, debug=debug
          )
          if self.video_tower_config.get("freeze", False):
              video_tokens = jax.lax.stop_gradient(video_tokens)
          if self.video_tower_config.get("projection_size") is not None:
              video_tokens = self.video_projection(video_tokens)
          return video_tokens
  
      video_tokens = []
      for (
          modality_name,
          modality_config,
      ) in self.video_tower_config.modality_configs.items():
          tokens = self.video_encoders[modality_name](
              inputs[modality_name], train=train, debug=debug
          )
          if modality_config.get("freeze", False):
              tokens = jax.lax.stop_gradient(tokens)
          if modality_config.get("projection_size") is not None:
              tokens = self.modality_projections[modality_name](tokens)
          if modality_config.get("apply_post_encoder_layer_norm"):
              tokens = self.modality_ln[modality_name](tokens)
          video_tokens.append(tokens)
      video_tokens = jnp.concatenate(video_tokens, axis=-1)
      if self.video_tower_config.get("projection_size") is not None:
          video_tokens = self.video_projection(video_tokens)
      return video_tokens
  
imports: from typing import Any, Dict, Optional
  import flax.linen
  import jax
  import jax.numpy
  import ml_collections
  from scenic.projects.unloc import action_segmentation_base_model
  from scenic.projects.unloc import encoders
  from scenic.projects.unloc import heads
  from scenic.projects.unloc import moment_retrieval_base_model
  from scenic.projects.unloc import temporal_localization_base_model
  from scenic.projects.unloc import video_text_fusion
label_desc: Use image node_id 3 for calling the VideoTextSingleTower obj's underlying member method code with example usage: obj.encode_video(inputs, train, debug) and returns: video_tokens, video_tokens