class_docstr: ## Auto-Regressive model
class_docstr_tok: ["#","#","Auto-Regressive","model"]
docstr: * `encoder` is the transformer [Encoder](../models.html#Encoder)
  * `src_embed` is the token
  [embedding module (with positional encodings)](../models.html#EmbeddingsWithLearnedPositionalEncoding)
  * `generator` is the [final fully connected layer](../models.html#Generator) that gives the logits.
docstr_tok: ["*","`","encoder","`","is","the","transformer","[","Encoder","]","(","..","\/models.html","#","Encoder",")","*","`","src_embed","`","is","the","token","[","embedding","module","(","with","positional","encodings",")","]","(","..","\/models.html","#","EmbeddingsWithLearnedPositionalEncoding",")","*","`","generator","`","is","the","[","final","fully","connected","layer","]","(","..","\/models.html","#","Generator",")","that","gives","the","logits","."]
code: def __init__(
      self, encoder: Encoder, src_embed: nn.Module, generator: nn.Module
  ):
      """
      * `encoder` is the transformer [Encoder](../models.html#Encoder)
      * `src_embed` is the token
      [embedding module (with positional encodings)](../models.html#EmbeddingsWithLearnedPositionalEncoding)
      * `generator` is the [final fully connected layer](../models.html#Generator) that gives the logits.
      """
      super().__init__()
      self.src_embed = src_embed
      self.encoder = encoder
      self.generator = generator
  
      # The mask will be initialized on the first call
      self.mask = None
  
file_path: annotated_deep_learning_paper_implementations/labml_nn/transformers/basic/autoregressive_experiment.py
imports: import torch
  from torch import nn
  from labml import experiment
  from labml.configs import option
  from labml_nn.experiments.nlp_autoregression import NLPAutoRegressionConfigs
  from labml_nn.transformers import TransformerConfigs, Encoder
  from labml_nn.transformers.utils import subsequent_mask
label_desc: Use image node_id 1 to create a new AutoregressiveTransformer object from inherited base classes: nn with example: obj = AutoregressiveTransformer(encoder, src_embed, generator)