class_docstr: Transformer encoder layer.
  
  Attributes:
    config: hyperparameters of the module
class_docstr_tok: ["Transformer","encoder","layer",".","Attributes",":","config",":","hyperparameters","of","the","module"]
docstr: Applies Encoder1DBlock module.
  
  Args:
    inputs: input data.
    encoder_mask: encoder self-attention mask.
    train: whether to apply dropout
  
  Returns:
    output after transformer encoder block.
docstr_tok: ["Applies","Encoder1DBlock","module",".","Args",":","inputs",":","input","data",".","encoder_mask",":","encoder","self-attention","mask",".","train",":","whether","to","apply","dropout","Returns",":","output","after","transformer","encoder","block","."]
code: def __call__(self, inputs, encoder_mask=None, train=False):
      """Applies Encoder1DBlock module.
  
      Args:
        inputs: input data.
        encoder_mask: encoder self-attention mask.
        train: whether to apply dropout
  
      Returns:
        output after transformer encoder block.
      """
      cfg = self.config
  
      # Attention block.
      assert inputs.ndim == 3
      x = nn.LayerNorm(dtype=cfg.dtype)(inputs)
      x = nn.SelfAttention(
          num_heads=cfg.num_heads,
          dtype=cfg.dtype,
          qkv_features=cfg.qkv_dim,
          kernel_init=nn.initializers.xavier_uniform(),
          bias_init=nn.initializers.normal(stddev=1e-6),
          use_bias=False,
          broadcast_dropout=False,
          dropout_rate=cfg.attention_dropout_rate,
          deterministic=not train,
      )(x, encoder_mask)
  
      x = nn.Dropout(rate=cfg.dropout_rate)(x, deterministic=not train)
      x = x + inputs
  
      # MLP block.
      y = nn.LayerNorm(dtype=cfg.dtype)(x)
      y = MlpBlock(config=cfg)(y, train=train)
  
      return x + y
  
imports: from typing import Any, Dict, Optional, Tuple
  from absl import logging
  from flax import linen
  from flax.training import common_utils
  from immutabledict import immutabledict
  import jax
  from jax import lax
  import jax.numpy
  import ml_collections
  import numpy
  from scenic.model_lib.base_models import base_model
  from scenic.model_lib.base_models import model_utils
  from scenic.projects.mbt import model
  from scenic.projects.mbt.model import temporal_encode
label_desc: Use image node_id 1 for calling the Encoder1DBlock obj's underlying member method code with example usage: obj.__call__(inputs, encoder_mask, train) and returns: unknown