class_docstr: Transformer decoder consisting of *config.decoder_layers* layers. Each layer is a [`M2M100DecoderLayer`]
  
  Args:
      config: M2M100Config
      embed_tokens (nn.Embedding): output embedding
class_docstr_tok: ["Transformer","decoder","consisting","of","*","config.decoder_layers","*","layers",".","Each","layer","is","a","[","`","M2M100DecoderLayer","`","]","Args",":","config",":","M2M100Config","embed_tokens","(","nn.Embedding",")",":","output","embedding"]
code: def __init__(
      self,
      config: M2M100Config,
      embed_tokens: Optional[nn.Embedding] = None,
  ):
      super().__init__(config)
      self.dropout = config.dropout
      self.layerdrop = config.decoder_layerdrop
      self.padding_idx = config.pad_token_id
      self.max_target_positions = config.max_position_embeddings
      self.embed_scale = (
          math.sqrt(config.d_model) if config.scale_embedding else 1.0
      )
  
      self.embed_tokens = nn.Embedding(
          config.vocab_size, config.d_model, self.padding_idx
      )
  
      if embed_tokens is not None:
          self.embed_tokens.weight = embed_tokens.weight
  
      self.embed_positions = M2M100SinusoidalPositionalEmbedding(
          config.max_position_embeddings,
          config.d_model,
          self.padding_idx,
      )
      self.layers = nn.ModuleList(
          [
              M2M100DecoderLayer(config)
              for _ in range(config.decoder_layers)
          ]
      )
      self.layer_norm = nn.LayerNorm(config.d_model)
  
      self.gradient_checkpointing = False
      # Initialize weights and apply final processing
      self.post_init()
  
imports: import math
  from typing import List, Optional, Tuple, Union
  import torch
  from torch import nn
  from torch.nn import CrossEntropyLoss
  from ...activations import ACT2FN
  from ...integrations.deepspeed import is_deepspeed_zero3_enabled
  from ...modeling_attn_mask_utils import _prepare_4d_attention_mask, _prepare_4d_causal_attention_mask
  from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, Seq2SeqLMOutput, Seq2SeqModelOutput
  from ...modeling_utils import PreTrainedModel
  from ...utils import add_code_sample_docstrings, add_end_docstrings, add_start_docstrings, add_start_docstrings_to_model_forward, logging, replace_return_docstrings
  from .configuration_m2m_100 import M2M100Config
label_desc: Use image node_id 1 to create a new M2M100Decoder object from inherited base classes: M2M100PreTrainedModel with example: obj = M2M100Decoder(config, embed_tokens)