class_docstr: Transformer decoder as in Vaswani et al, 2017: Attention is all you need.
  In training, computation scores for each position of the known target sequence are computed in parallel,
  yielding most of the speedup.
  At inference time, the decoder block is evaluated again and again over a maximum length input sequence that is
  initially filled with zeros and grows during beam search with predicted tokens. Appropriate masking at every
  time-step ensures correct self-attention scores and is updated with every step.
  
  :param config: Transformer configuration.
  :param inference_only: Only use the model for inference enabling some optimizations,
                         such as disabling the auto-regressive mask.
  :param dtype: Torch data type for parameters.
  :param clamp_to_dtype: Avoid -inf/inf by clamping outputs to min/max finite
                         values for their dtype.
code: def __init__(
      self,
      config: TransformerConfig,
      inference_only: bool = False,
      dtype: Optional[pt.dtype] = None,
      clamp_to_dtype: bool = False,
  ) -> None:
      Decoder.__init__(self)
      pt.nn.Module.__init__(self)
      self.config = config
      self.pos_embedding = layers.PositionalEmbeddings(
          weight_type=self.config.positional_embedding_type,
          num_embed=self.config.model_size,
          max_seq_len=self.config.max_seq_len_target,
          scale_up_input=True,
          scale_down_positions=False,
          dtype=dtype,
      )
      self.autoregressive_mask = transformer.AutoRegressiveMask()
  
      self.layers = pt.nn.ModuleList(  # using ModuleList because we have additional inputs
          transformer.TransformerDecoderBlock(
              config,
              inference_only=inference_only,
              dtype=dtype,
              clamp_to_dtype=clamp_to_dtype,
          )
          for _ in range(config.num_layers)
      )
  
      self.final_process = transformer.TransformerProcessBlock(
          sequence=config.preprocess_sequence,
          dropout=config.dropout_prepost,
          num_hidden=self.config.model_size,
          dtype=dtype,
          clamp_to_dtype=clamp_to_dtype,
      )
      self.dropout = pt.nn.Dropout(p=self.config.dropout_prepost)
      self.set_inference_only(inference_only)
  
imports: import logging
  from abc import abstractmethod
  from itertools import islice
  from typing import Dict, List, Optional, Tuple, Type, Union
  import torch
  from .None import constants
  from .None import layers
  from .None import transformer
  from .transformer import TransformerConfig
label_desc: Use image node_id 1 to create a new TransformerDecoder object from inherited base classes: Decoder with example: obj = TransformerDecoder(config, inference_only, dtype, clamp_to_dtype)