class_docstr: Transformer encoder layer.
  
  Attributes:
    config: TransformerConfig dataclass containing hyperparameters.
class_docstr_tok: ["Transformer","encoder","layer",".","Attributes",":","config",":","TransformerConfig","dataclass","containing","hyperparameters","."]
docstr: Applies Encoder1DBlock module.
  
  Args:
    inputs: input data.
    encoder_mask: encoder self-attention mask.
  
  Returns:
    output after transformer encoder block.
docstr_tok: ["Applies","Encoder1DBlock","module",".","Args",":","inputs",":","input","data",".","encoder_mask",":","encoder","self-attention","mask",".","Returns",":","output","after","transformer","encoder","block","."]
code: def __call__(self, inputs, encoder_mask=None):
      """Applies Encoder1DBlock module.
  
      Args:
        inputs: input data.
        encoder_mask: encoder self-attention mask.
  
      Returns:
        output after transformer encoder block.
      """
      config = self.config
  
      # Attention block.
      assert inputs.ndim == 3
      x = nn.LayerNorm(dtype=config.dtype)(inputs)
      x = nn.SelfAttention(
          num_heads=config.num_heads,
          dtype=config.dtype,
          qkv_features=config.qkv_dim,
          kernel_init=config.kernel_init,
          bias_init=config.bias_init,
          use_bias=False,
          broadcast_dropout=False,
          dropout_rate=config.attention_dropout_rate,
          deterministic=config.deterministic,
      )(x, encoder_mask)
  
      x = nn.Dropout(rate=config.dropout_rate)(
          x, deterministic=config.deterministic
      )
      x = x + inputs
  
      # MLP block.
      y = nn.LayerNorm(dtype=config.dtype)(x)
      y = MlpBlock(config=config)(y)
  
      return x + y
  
imports: from __future__ import annotations
  from typing import Callable, Any, Optional
  from flax import linen
  from flax import struct
  from jax import lax
  import jax.numpy
  import numpy
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) and returns: unknown