class_docstr: Transformer encoder layer.
code: def __call__(
      self,
      inputs,
      att_mask=None,
      encoder_mask=None,
      deterministic=False,
  ):
      cfg = self.config
  
      # Relative position embedding as attention biases.
      encoder_bias = self.relative_embedding(
          inputs.shape[-2], inputs.shape[-2], True
      )
  
      # Attention block.
      assert inputs.ndim == 3
      x = t5_layers.LayerNorm(dtype=cfg.dtype)(inputs)
      if att_mask is not None:
          x = x * att_mask
      # [batch, length, emb_dim] -> [batch, length, emb_dim]
      x, attn_weights = MultiHeadDotProductAttention(
          num_heads=cfg.num_heads,
          dtype=cfg.dtype,
          head_dim=cfg.head_dim,
          dropout_rate=cfg.dropout_rate,
          float32_logits=cfg.float32_attention_logits,
      )(x, x, encoder_mask, encoder_bias, deterministic=deterministic)
      x = nn.Dropout(rate=cfg.dropout_rate, broadcast_dims=(-2,))(
          x, deterministic=deterministic
      )
      x = x + inputs
  
      # MLP block.
      y = t5_layers.LayerNorm(dtype=cfg.dtype)(x)
      # [batch, length, emb_dim] -> [batch, length, emb_dim]
      y = t5_layers.MlpBlock(
          intermediate_dim=cfg.mlp_dim,
          activations=cfg.mlp_activations,
          intermediate_dropout_rate=cfg.dropout_rate,
          dtype=cfg.dtype,
      )(y, deterministic=deterministic)
      y = nn.Dropout(rate=cfg.dropout_rate, broadcast_dims=(-2,))(
          y, deterministic=deterministic
      )
      y = y + x
  
      return y, attn_weights
  
imports: import functools
  from typing import Optional, Sequence
  from flax import linen
  import jax
  import jax.numpy
  from scenic.projects.knowledge_visual_language.models import constants
  from t5x.examples.t5 import layers
  from t5x.examples.t5 import network
label_desc: Use image node_id 1 for calling the FusionEncoderLayer obj's underlying member method code with example usage: obj.__call__(inputs, att_mask, encoder_mask, deterministic) and returns: y,  attn_weights