class_docstr: Transformer feature pyramid encoder.
  
  Attributes:
    num_layers: Number of layers.
    mlp_dim: Dimension of the mlp on top of attention block.
    num_heads: Number of attention heads.
    feature_pyramid_config: Feature pyramid config.
    downsample_strategy: Strategy to downsample video tokens. Options are:
      'subsample', 'avg_pool', or 'max_pool'.
    positional_embedding: 'learned', 'sinusoid', or 'none'.
    positional_embedding_max_length: If set, the positional embeddings/encodings
      are applied to the first N elements in the input sequence. If not set, the
      positional embeddings/encodings are added to the entire input sequence.
    dropout_rate: Dropout rate.
    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.
    window_size: Window size for window attention blocks.
    window_block_indexes: Tuple. Indexes for blocks using window attention.
    dtype: Dtype of activations.
docstr: Subsamples video tokens.
code: def _downsample_video_tokens(
      self,
      x: jnp.ndarray,
      num_text_tokens: int,
      sampled_indices: np.ndarray,
  ) -> jnp.ndarray:
      """Subsamples video tokens."""
  
      downsample_fns = {
          "max_pool": self._max_pool,
          "avg_pool": self._avg_pool,
          "strided_depthwise_conv": self._strided_depthwise_conv,
          "strided_conv": self._strided_conv,
          "subsample": functools.partial(
              self._subsample, sampled_indices=sampled_indices
          ),
      }
      if num_text_tokens > 0:
          text_tokens = x[:, -num_text_tokens:]
          y = downsample_fns[self.downsample_strategy](
              x[:, :-num_text_tokens]
          )
          x = jnp.concatenate([y, text_tokens], axis=1)
      else:
          x = downsample_fns[self.downsample_strategy](x)
      return x
  
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 7 for calling the FeaturePyramidEncoder obj's underlying member method code with example usage: obj._downsample_video_tokens(x, num_text_tokens, sampled_indices) and returns: x