class_docstr: T5 encoder as a separate model.
  
  This module contains the encoder part of a pretrained T5. It is useful when
  adopting the pretrained T5 encoder as a part of a larger network. Note that
  the embedding layer should be created outside the module and provided as a
  parameter `shared_embedding` to share it in other parts of the network (e.g.,
  text encoder). If `shared_embedding` is not provided, the embedding layer is
  created within the module.
  
  Attributes:
    vocab_size: Size of the vocabulary.
    emb_dim: Size of the embeddings.
    num_heads: Number of attention heads.
    num_encoder_layers: Number of encoder layers.
    num_decoder_layers: Number of decoder layers.
    head_dim: Size of the embeddings in each head.
    mlp_dim: Size of the MLP output embeddings.
    dropout_rate: Dropout rate.
    dtype: Data type.
    mlp_activations: Sequence of activations in MLP.
    logits_via_embedding: Use the embedding weights for computing logits.
    shared_embedding: Optional. Embedding layer that is shared outside this
      module. If not given, a non-shared embedding layer will be created within
      the module.
docstr: Applies Transformer encoder-branch on the inputs.
docstr_tok: ["Applies","Transformer","encoder-branch","on","the","inputs","."]
code: def __call__(
      self,
      encoder_input_tokens,
      encoder_segment_ids=None,
      enable_dropout=True,
  ):
      """Applies Transformer encoder-branch on the inputs."""
      cfg = self.t5_config
      assert encoder_input_tokens.ndim == 2  # (batch, len)
  
      # Make padding attention mask.
      encoder_mask = t5_layers.make_attention_mask(
          encoder_input_tokens > 0,
          encoder_input_tokens > 0,
          dtype=cfg.dtype,
      )
      # Add segmentation block-diagonal attention mask if using segmented data.
      if encoder_segment_ids is not None:
          encoder_mask = t5_layers.combine_masks(
              encoder_mask,
              t5_layers.make_attention_mask(
                  encoder_segment_ids,
                  encoder_segment_ids,
                  jnp.equal,
                  dtype=cfg.dtype,
              ),
          )
  
      return self.encoder_module(
          encoder_input_tokens,
          encoder_mask,
          deterministic=not enable_dropout,
      )
  
imports: import functools
  from typing import Any, Dict, Mapping, Optional, Sequence, Tuple
  import flax.linen
  import jax
  import jax.numpy
  from scenic.model_lib.base_models import base_model
  from t5x import decoding
  from t5x.examples.t5 import layers
  from t5x.examples.t5 import network
  from t5x.models import DecodeFnCallable
label_desc: Use image node_id 2 for calling the T5Encoder obj's underlying member method code with example usage: obj.__call__(encoder_input_tokens, encoder_segment_ids, enable_dropout) and returns: self