code: def __init__(
      self,
      vocab_size,
      d_model,
      n_head,
      n_layer,
      attn_span,
      emb_dropout,
      aux_loss_scaler,
      adapt_span_layer,
      **kargs,
  ):
      nn.Module.__init__(self)
      # token embeddings
      self.in_emb = nn.Embedding(vocab_size, d_model)
      nn.init.normal_(self.in_emb.weight, mean=0, std=d_model**-0.5)
      self.out_emb = nn.Linear(d_model, vocab_size)
      self.aux_loss_scaler = aux_loss_scaler
      if emb_dropout > 0:
          self.emb_dropout = nn.Dropout(emb_dropout)
      else:
          self.emb_dropout = None
      # position embeddings
      self.key_pe = nn.Parameter(
          torch.randn(1, d_model // n_head, attn_span)
      )
  
      self.layers = nn.ModuleList()
      self.layers.extend(
          TransformerSeqLayer(
              d_model=d_model,
              n_head=n_head,
              attn_span=attn_span,
              adapt_span_layer=adapt_span_layer,
              **kargs,
          )
          for _ in range(n_layer)
      )
  
imports: import math
  import torch
  import torch.nn
  import torch.nn.functional
  from fairseq.modules.layer_norm import LayerNorm
  from .adaptive_span_attention import AdaptiveSpan
label_desc: Use image node_id 1 to create a new TransformerSeq object from inherited base classes: nn with example: obj = TransformerSeq(vocab_size, d_model, n_head, n_layer, attn_span, emb_dropout, aux_loss_scaler, adapt_span_layer)