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.
    deterministic: if true dropout is applied otherwise not.
  
  Returns:
    output after transformer encoder block.
docstr_tok: ["Applies","Encoder1DBlock","module",".","Args",":","inputs",":","input","data",".","deterministic",":","if","true","dropout","is","applied","otherwise","not",".","Returns",":","output","after","transformer","encoder","block","."]
code: def __call__(self, inputs, deterministic):
      """Applies Encoder1DBlock module.
  
      Args:
        inputs: input data.
        deterministic: if true dropout is applied otherwise not.
  
      Returns:
        output after transformer encoder block.
      """
      config = self.config
  
      # Attention block.
      assert inputs.ndim == 3
      x = nn.LayerNorm(dtype=config.dtype)(inputs)
      x = nn.MultiHeadDotProductAttention(
          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=deterministic,
      )(x)
  
      x = nn.Dropout(rate=config.dropout_rate)(
          x, deterministic=deterministic
      )
      x = x + inputs
  
      # MLP block.
      y = nn.LayerNorm(dtype=config.dtype)(x)
      y = MlpBlock(config=config)(y, deterministic=deterministic)
      return x + y
  
file_path: flax/examples/nlp_seq/models.py
imports: from typing import Callable, Any, Optional
  from flax import linen
  from flax import struct
  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, deterministic) and returns: unknown