class_docstr: Multiview Transformer Encoder.
  
  Attributes:
    view_configs: Model configs for each view (e.g., num_heads, mlp_dim, etc).
    cross_view_fusion: Cross view fusion config.
    dropout_rate: Dropout rate.
    attention_dropout_rate: Dropout for attention heads.
    stochastic_depth: probability of dropping a layer linearly grows from 0 to
      the provided value. Our implementation of stochastic depth follows the
      timm library, which does per-example layer dropping and uses independent
      dropping patterns for each skip-connection.
    dtype: Any of activations.
docstr: Applies Transformer model on the tokens.
  
  This function will be called within a vmap along the time axis. Before
  calling this function, we need to make sure all elements in the list have
  the same temporal dimension.
  
  Args:
    tokens: A sequence of input tubelet tokens. Each one is a 3D float tensor
      of shape (batch, sequence_len, channels). We assume that tokens[0]
      contains tokens from the largest view while tokens[-1] are from the
      smallest view. We define a view as a representation of the input video
      composed of tubelets. A larger view corresponds to larger tubelets.
    bottleneck: A 3D float tensor of shape (batch, num_tokens, channels)
      representing a set of tokens used for fusing information among views.
    train: Whether or not it is in training.
  
  Returns:
    A list of activations after encoding for each view. They have the same
    shapes as their input counterparts.
docstr_tok: ["Applies","Transformer","model","on","the","tokens",".","This","function","will","be","called","within","a","vmap","along","the","time","axis",".","Before","calling","this","function",",","we","need","to","make","sure","all","elements","in","the","list","have","the","same","temporal","dimension",".","Args",":","tokens",":","A","sequence","of","input","tubelet","tokens",".","Each","one","is","a","3D","float","tensor","of","shape","(","batch",",","sequence_len",",","channels",")",".","We","assume","that","tokens","[","0","]","contains","tokens","from","the","largest","view","while","tokens","[","-1","]","are","from","the","smallest","view",".","We","define","a","view","as","a","representation","of","the","input","video","composed","of","tubelets",".","A","larger","view","corresponds","to","larger","tubelets",".","bottleneck",":","A","3D","float","tensor","of","shape","(","batch",",","num_tokens",",","channels",")","representing","a","set","of","tokens","used","for","fusing","information","among","views",".","train",":","Whether","or","not","it","is","in","training",".","Returns",":","A","list","of","activations","after","encoding","for","each","view",".","They","have","the","same","shapes","as","their","input","counterparts","."]
code: def __call__(
      self,
      tokens: Sequence[jnp.ndarray],
      bottleneck: Union[jnp.ndarray, None],
      train: bool = False,
  ) -> List[jnp.ndarray]:
      """Applies Transformer model on the tokens.
  
      This function will be called within a vmap along the time axis. Before
      calling this function, we need to make sure all elements in the list have
      the same temporal dimension.
  
      Args:
        tokens: A sequence of input tubelet tokens. Each one is a 3D float tensor
          of shape (batch, sequence_len, channels). We assume that tokens[0]
          contains tokens from the largest view while tokens[-1] are from the
          smallest view. We define a view as a representation of the input video
          composed of tubelets. A larger view corresponds to larger tubelets.
        bottleneck: A 3D float tensor of shape (batch, num_tokens, channels)
          representing a set of tokens used for fusing information among views.
        train: Whether or not it is in training.
  
      Returns:
        A list of activations after encoding for each view. They have the same
        shapes as their input counterparts.
      """
  
      for t in tokens:
          assert t.ndim == 3  # Shape is `[batch, len, emb]`.
      dtype = jax.dtypes.canonicalize_dtype(self.dtype)
      xs = self._add_posembed(tokens)
      max_num_layers = max(
          [config["num_layers"] for config in self.view_configs]
      )
      fusion_layers = (
          []
          if self.cross_view_fusion is None
          else self.cross_view_fusion.fusion_layers
      )
  
      if (
          self.cross_view_fusion is None
          or self.cross_view_fusion.type == "cross_view_attention"
      ):
          return self._build_with_cross_view_attention(
              xs, fusion_layers, max_num_layers, train, dtype
          )
      if self.cross_view_fusion.type == "bottleneck":
          return self._build_with_bottleneck(
              xs,
              bottleneck,
              fusion_layers,
              max_num_layers,
              train,
              dtype,
          )
      raise ValueError(
          f"Invalid cross view fusion type: {self.cross_view_fusion.type}."
      )
  
imports: import functools
  from typing import Any, List, Sequence, Tuple, Union
  import flax.linen
  import jax
  import jax.numpy
  import ml_collections
  from scenic.model_lib.layers import attention_layers
  from scenic.model_lib.layers import nn_layers
  from scenic.projects.baselines import vit
  from scenic.projects.mtv import model_utils
  from scenic.projects.vivit import model
  from scenic.train_lib import train_utils
label_desc: Use image node_id 5 for calling the MultiviewEncoder obj's underlying member method code with example usage: obj.__call__(tokens, bottleneck, train) and returns: self, self