class_docstr: Transformer encoder block.
  
  Attributes:
    mlp_dim: Dimension of the mlp on top of attention block.
    num_heads: Number of heads.
    dtype: The dtype of the computation (default: float32).
    dropout_rate: Dropout rate.
    attention_dropout_rate: Dropout for attention heads.
    attention_kernel_initializer: Initializer to use for attention
      layers.
    droplayer_p: Probability of dropping a layer.
  
  
  
  Returns:
    Output after transformer encoder block.
class_docstr_tok: ["Transformer","encoder","block",".","Attributes",":","mlp_dim",":","Dimension","of","the","mlp","on","top","of","attention","block",".","num_heads",":","Number","of","heads",".","dtype",":","The","dtype","of","the","computation","(","default",":","float32",")",".","dropout_rate",":","Dropout","rate",".","attention_dropout_rate",":","Dropout","for","attention","heads",".","attention_kernel_initializer",":","Initializer","to","use","for","attention","layers",".","droplayer_p",":","Probability","of","dropping","a","layer",".","Returns",":","Output","after","transformer","encoder","block","."]
docstr: Applies Encoder1DBlock module.
docstr_tok: ["Applies","Encoder1DBlock","module","."]
code: def __call__(
      self, inputs: jnp.ndarray, deterministic: bool
  ) -> jnp.ndarray:
      """Applies Encoder1DBlock module."""
  
      # Attention block.
      x = nn.LayerNorm(dtype=self.dtype)(inputs)
      x = nn.MultiHeadDotProductAttention(
          num_heads=self.num_heads,
          kernel_init=self.attention_kernel_initializer,
          broadcast_dropout=False,
          dropout_rate=self.attention_dropout_rate,
          dtype=self.dtype,
      )(x, x, deterministic=deterministic)
      x = nn.Dropout(rate=self.dropout_rate)(x, deterministic)
  
      drop_pattern = self.get_drop_pattern(x, deterministic)
      x = x * (1.0 - drop_pattern) + inputs
  
      # MLP block.
      y = nn.LayerNorm(dtype=self.dtype)(x)
      y = attention_layers.MlpBlock(
          mlp_dim=self.mlp_dim,
          dtype=self.dtype,
          dropout_rate=self.dropout_rate,
          activation_fn=nn.gelu,
          kernel_init=nn.initializers.xavier_uniform(),
          bias_init=nn.initializers.normal(stddev=1e-6),
      )(y, deterministic=deterministic)
  
      drop_pattern = self.get_drop_pattern(x, deterministic)
      return y * (1.0 - drop_pattern) + x
  
imports: import functools
  from typing import Any, Callable, Dict, Optional, Sequence, Tuple
  from absl import logging
  import flax.linen
  from flax.linen.linear import default_kernel_init
  from immutabledict import immutabledict
  import jax
  import jax.numpy
  import ml_collections
  import numpy
  from scenic.model_lib.base_models import base_model
  from scenic.model_lib.base_models import classification_model
  from scenic.model_lib.base_models import model_utils
  from scenic.model_lib.base_models.classification_model import ClassificationModel
  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.mbt import model_utils
label_desc: Use image node_id 2 for calling the EncoderBlock obj's underlying member method code with example usage: obj.__call__(inputs, deterministic) and returns: unknown