class_docstr: ## Auto regressive model
code: def forward(self, src: torch.Tensor):
      # Create subsequent mask, so that the transformer can only pay attention to past tokens.
      if self.src_mask is None or self.src_mask.size(0) != len(src):
          self.src_mask = subsequent_mask(len(src)).to(src.device)
      # Embed the tokens (`src`) and run it through the the transformer
      res = self.encoder(self.src_embed(src), self.src_mask)
      # Generate logits of the next token
      return self.generator(res)
  
imports: import dataclasses
  import torch
  from labml_helpers.module import Module
  from torch import nn
  from torch.utils.data import Dataset, DataLoader
  from labml import experiment, lab, tracker, monit, logger
  from labml.logger import Text
  from labml.utils.download import download_file
  from labml_nn.experiments.nlp_autoregression import transpose_batch
  from labml_nn.optimizers.noam import Noam
  from labml_nn.transformers import Encoder, MultiHeadAttention
  from labml_nn.transformers.feed_forward import FeedForward
  from labml_nn.transformers.models import EmbeddingsWithPositionalEncoding, TransformerLayer
  from labml_nn.transformers.utils import subsequent_mask
label_desc: Use image node_id 2 for calling the AutoregressiveModel obj's underlying member method code with example usage: obj.forward(src) and returns: self