class_docstr: Transformer encoder-decoder layer.
  
  Attributes:
    config: TransformerConfig dataclass containing hyperparameters.
class_docstr_tok: ["Transformer","encoder-decoder","layer",".","Attributes",":","config",":","TransformerConfig","dataclass","containing","hyperparameters","."]
docstr: Applies EncoderDecoder1DBlock module.
  
  Args:
    targets: input data for decoder
    encoded: input data from encoder
    decoder_mask: decoder self-attention mask.
    encoder_decoder_mask: encoder-decoder attention mask.
  
  Returns:
    output after transformer encoder-decoder block.
docstr_tok: ["Applies","EncoderDecoder1DBlock","module",".","Args",":","targets",":","input","data","for","decoder","encoded",":","input","data","from","encoder","decoder_mask",":","decoder","self-attention","mask",".","encoder_decoder_mask",":","encoder-decoder","attention","mask",".","Returns",":","output","after","transformer","encoder-decoder","block","."]
code: def __call__(
      self,
      targets,
      encoded,
      decoder_mask=None,
      encoder_decoder_mask=None,
  ):
      """Applies EncoderDecoder1DBlock module.
  
      Args:
        targets: input data for decoder
        encoded: input data from encoder
        decoder_mask: decoder self-attention mask.
        encoder_decoder_mask: encoder-decoder attention mask.
  
      Returns:
        output after transformer encoder-decoder block.
      """
      config = self.config
  
      # Decoder block.
      assert targets.ndim == 3
      x = nn.LayerNorm(dtype=config.dtype)(targets)
      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,
          decode=config.decode,
      )(x, decoder_mask)
      x = nn.Dropout(rate=config.dropout_rate)(
          x, deterministic=config.deterministic
      )
      x = x + targets
  
      # Encoder-Decoder block.
      y = nn.LayerNorm(dtype=config.dtype)(x)
      y = 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=config.deterministic,
      )(y, encoded, encoder_decoder_mask)
  
      y = nn.Dropout(rate=config.dropout_rate)(
          y, deterministic=config.deterministic
      )
      y = y + x
  
      # MLP block.
      z = nn.LayerNorm(dtype=config.dtype)(y)
      z = MlpBlock(config=config)(z)
  
      return y + z
  
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 EncoderDecoder1DBlock obj's underlying member method code with example usage: obj.__call__(targets, encoded, decoder_mask, encoder_decoder_mask) and returns: unknown