class_docstr: DETR Transformer Decoder.
  
  Attributes:
    num_heads: Number of heads.
    num_layers: Number of layers.
    qkv_dim: Dimension of the query/key/value.
    mlp_dim: Dimension of the mlp on top of attention block.
    normalize_before: If use LayerNorm before attention/mlp blocks.
    return_intermediate: If return the outputs from intermediate layers.
    padding_mask: Binary mask containing 0 for padding tokens.
    dropout_rate:Dropout rate.
    attention_dropout_rate:Dropout rate for attention weights.
    dtype: Data type of the computation (default: float32).
class_docstr_tok: ["DETR","Transformer","Decoder",".","Attributes",":","num_heads",":","Number","of","heads",".","num_layers",":","Number","of","layers",".","qkv_dim",":","Dimension","of","the","query\/key\/value",".","mlp_dim",":","Dimension","of","the","mlp","on","top","of","attention","block",".","normalize_before",":","If","use","LayerNorm","before","attention\/mlp","blocks",".","return_intermediate",":","If","return","the","outputs","from","intermediate","layers",".","padding_mask",":","Binary","mask","containing","0","for","padding","tokens",".","dropout_rate",":","Dropout","rate",".","attention_dropout_rate",":","Dropout","rate","for","attention","weights",".","dtype",":","Data","type","of","the","computation","(","default",":","float32",")","."]
docstr: Applies Decoder on the inputs.
  
  Args:
    obj_queries: Input data for decoder.
    encoder_output: Output of encoder, which are encoded inputs.
    key_padding_mask: Binary mask containing 0 for padding tokens in the keys.
    pos_embedding: Positional Embedding to be added to the keys.
    query_pos_emb: Positional Embedding to be added to the queries.
    train: Whether it is training.
  
  Returns:
    Output of a transformer decoder.
code: def __call__(
      self,
      obj_queries: jnp.ndarray,
      encoder_output: jnp.ndarray,
      *,
      key_padding_mask: Optional[jnp.ndarray] = None,
      pos_embedding: Optional[jnp.ndarray] = None,
      query_pos_emb: Optional[jnp.ndarray] = None,
      train: bool = False,
  ) -> jnp.ndarray:
      """Applies Decoder on the inputs.
  
      Args:
        obj_queries: Input data for decoder.
        encoder_output: Output of encoder, which are encoded inputs.
        key_padding_mask: Binary mask containing 0 for padding tokens in the keys.
        pos_embedding: Positional Embedding to be added to the keys.
        query_pos_emb: Positional Embedding to be added to the queries.
        train: Whether it is training.
  
      Returns:
        Output of a transformer decoder.
      """
      assert encoder_output.ndim == 3  # `[batch, len, features]`
      assert (
          obj_queries.ndim == 3
      )  # `[batch, num queries, embedding size]`
      y = obj_queries
      outputs = []
      for lyr in range(self.num_layers):
          y = DecoderBlock(
              qkv_dim=self.qkv_dim,
              mlp_dim=self.mlp_dim,
              num_heads=self.num_heads,
              pre_norm=self.normalize_before,
              dropout_rate=self.dropout_rate,
              attention_dropout_rate=self.attention_dropout_rate,
              dtype=self.dtype,
              name=f"decoderblock_{lyr}",
          )(
              y,
              encoder_output,
              pos_embedding=pos_embedding,
              query_pos_emb=query_pos_emb,
              key_padding_mask=key_padding_mask,
              train=train,
          )
          if self.return_intermediate:
              outputs.append(y)
  
      if self.return_intermediate:
          y = jnp.stack(outputs, axis=0)
      return y if self.norm is None else self.norm(y)
  
imports: import functools
  from typing import Any, Callable, Dict, Tuple, Optional
  import flax.linen
  import jax
  from jax.nn import initializers
  import jax.numpy
  import ml_collections
  import numpy
  from scenic.model_lib.layers import attention_layers
  from scenic.projects.baselines import resnet
  from scenic.projects.baselines.detr import detr_base_model
label_desc: Use image node_id 1 for calling the Decoder obj's underlying member method code with example usage: obj.__call__(obj_queries, encoder_output) and returns: unknown