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","."]
code: def get_drop_pattern(self, x, deterministic):
      if not deterministic and self.droplayer_p:
          shape = (x.shape[0],) + (1,) * (x.ndim - 1)
          return jax.random.bernoulli(
              self.make_rng("dropout"), self.droplayer_p, shape
          ).astype("float32")
      else:
          return 0.0
  
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 1 for calling the EncoderBlock obj's underlying member method code with example usage: obj.get_drop_pattern(x, deterministic) and returns: jax, int