class_docstr: Implements video-text fusion by self attention.
  
  We append the text CLS token to the video tokens and then feed the
  concatenated sequence into a Transformer.
  
  Attributes:
    self_attention_encoder_config: The config of the self attention encoder.
    self_attention_encoder_name: The type of self attention encoder.
docstr: Fuses video and one text embedding via self attention.
  
  Args:
    video_tokens: A 3D float tensor of shape (batch_size, sequence_length,
      channels) representing the video tokens.
    video_input_mask: A 2D binary tensor of shape (batch_size,
      sequence_length).
    text_emb: A 1D float tensor of shape (channels,) representing the text
      embedding.
    encoder: The Transformer encoder.
    task: 'action_segmentation', 'temporal_localization', or
      'moment_retrieval'.
    train: Whether or not the model is under training.
  
  Returns:
    Video tokens in shape (batch size, sequence_length, channels) and text
    token in shape (batch_size, channels).
code: def _self_attention_encode_per_text_emb(
      self,
      video_tokens: jnp.ndarray,
      video_input_mask: jnp.ndarray,
      text_emb: jnp.ndarray,
      encoder: nn.Module,
      task: str,
      train: bool,
  ) -> Tuple[jnp.ndarray, jnp.ndarray]:
      """Fuses video and one text embedding via self attention.
  
      Args:
        video_tokens: A 3D float tensor of shape (batch_size, sequence_length,
          channels) representing the video tokens.
        video_input_mask: A 2D binary tensor of shape (batch_size,
          sequence_length).
        text_emb: A 1D float tensor of shape (channels,) representing the text
          embedding.
        encoder: The Transformer encoder.
        task: 'action_segmentation', 'temporal_localization', or
          'moment_retrieval'.
        train: Whether or not the model is under training.
  
      Returns:
        Video tokens in shape (batch size, sequence_length, channels) and text
        token in shape (batch_size, channels).
      """
      assert task in {
          "action_segmentation",
          "moment_retrieval",
          "temporal_localization",
      }
      tiled_text_emb = jnp.tile(
          text_emb[None, None, :], [video_tokens.shape[0], 1, 1]
      )
      tokens = jnp.concatenate(
          [
              video_tokens,
              tiled_text_emb,
          ],
          axis=1,
      )
      feature_pyramid_config = self.self_attention_encoder_config.get(
          "feature_pyramid_config"
      )
      if feature_pyramid_config is None:
          video_input_masks = [video_input_mask]
      else:
          video_input_masks = model_utils.create_pyramid_input_masks(
              video_input_mask,
              num_features_level0=feature_pyramid_config.num_features_level0,
              num_pyramid_levels=len(
                  feature_pyramid_config.feature_pyramid_levels
              ),
              feature_pyramid_downsample_stride=feature_pyramid_config.feature_pyramid_downsample_stride,
              num_text_tokens=0,
          )
      input_mask = model_utils.merge_pyramid_input_masks(
          video_input_masks,
          input_text_mask=jnp.ones(
              (video_tokens.shape[0], 1), dtype=jnp.int32
          ),
      )
      tokens = encoder(tokens, input_mask=input_mask, train=train)
      return tokens[:, :-1], tokens[:, -1]
  
imports: import functools
  from typing import Callable, List, Optional, Sequence, Tuple
  from absl import logging
  import flax.linen
  import jax
  import jax.numpy
  import ml_collections
  import numpy
  from scenic.model_lib.layers import attention_layers
  from scenic.projects.baselines import vit
  from scenic.projects.unloc import encoders
  from scenic.projects.unloc import model_utils
label_desc: Use image node_id 1 for calling the VideoTextEmbSelfAttentionFusion obj's underlying member method code with example usage: obj._self_attention_encode_per_text_emb(video_tokens, video_input_mask, text_emb, encoder, task, train) and returns: tokens,  tokens