class_docstr: ## Transformer XL Layer
  
  The transformer XL model comprises of a number of these layers.
class_docstr_tok: ["#","#","Transformer","XL","Layer","The","transformer","XL","model","comprises","of","a","number","of","these","layers","."]
docstr: * `d_model` is the token embedding size
  * `self_attn` is the [self attention module](relative_mha.html)
  * `feed_forward` is the feed forward module
  * `dropout_prob` is the probability of dropping out after self attention and FFN
docstr_tok: ["*","`","d_model","`","is","the","token","embedding","size","*","`","self_attn","`","is","the","[","self","attention","module","]","(","relative_mha.html",")","*","`","feed_forward","`","is","the","feed","forward","module","*","`","dropout_prob","`","is","the","probability","of","dropping","out","after","self","attention","and","FFN"]
code: def __init__(
      self,
      *,
      d_model: int,
      self_attn: RelativeMultiHeadAttention,
      feed_forward: FeedForward,
      dropout_prob: float,
  ):
      """
      * `d_model` is the token embedding size
      * `self_attn` is the [self attention module](relative_mha.html)
      * `feed_forward` is the feed forward module
      * `dropout_prob` is the probability of dropping out after self attention and FFN
      """
      super().__init__()
      self.size = d_model
      self.self_attn = self_attn
      self.feed_forward = feed_forward
      self.dropout = nn.Dropout(dropout_prob)
      self.norm_self_attn = nn.LayerNorm([d_model])
      self.norm_ff = nn.LayerNorm([d_model])
  
file_path: annotated_deep_learning_paper_implementations/labml_nn/transformers/xl/__init__.py
imports: from typing import List, Optional
  import torch
  import torch.nn
  from labml_helpers.module import Module
  from labml_nn.utils import clone_module_list
  from .relative_mha import RelativeMultiHeadAttention
  from ..feed_forward import FeedForward
label_desc: Use image node_id 1 to create a new TransformerXLLayer object from inherited base classes: Module with example: obj = TransformerXLLayer()