class_docstr: ## Vision Transformer
  
  This combines the [patch embeddings](#PatchEmbeddings),
  [positional embeddings](#LearnedPositionalEmbeddings),
  transformer and the [classification head](#ClassificationHead).
class_docstr_tok: ["#","#","Vision","Transformer","This","combines","the","[","patch","embeddings","]","(","#","PatchEmbeddings",")",",","[","positional","embeddings","]","(","#","LearnedPositionalEmbeddings",")",",","transformer","and","the","[","classification","head","]","(","#","ClassificationHead",")","."]
docstr: * `transformer_layer` is a copy of a single [transformer layer](../models.html#TransformerLayer).
   We make copies of it to make the transformer with `n_layers`.
  * `n_layers` is the number of [transformer layers](../models.html#TransformerLayer).
  * `patch_emb` is the [patch embeddings layer](#PatchEmbeddings).
  * `pos_emb` is the [positional embeddings layer](#LearnedPositionalEmbeddings).
  * `classification` is the [classification head](#ClassificationHead).
docstr_tok: ["*","`","transformer_layer","`","is","a","copy","of","a","single","[","transformer","layer","]","(","..","\/models.html","#","TransformerLayer",")",".","We","make","copies","of","it","to","make","the","transformer","with","`","n_layers","`",".","*","`","n_layers","`","is","the","number","of","[","transformer","layers","]","(","..","\/models.html","#","TransformerLayer",")",".","*","`","patch_emb","`","is","the","[","patch","embeddings","layer","]","(","#","PatchEmbeddings",")",".","*","`","pos_emb","`","is","the","[","positional","embeddings","layer","]","(","#","LearnedPositionalEmbeddings",")",".","*","`","classification","`","is","the","[","classification","head","]","(","#","ClassificationHead",")","."]
code: def __init__(
      self,
      transformer_layer: TransformerLayer,
      n_layers: int,
      patch_emb: PatchEmbeddings,
      pos_emb: LearnedPositionalEmbeddings,
      classification: ClassificationHead,
  ):
      """
      * `transformer_layer` is a copy of a single [transformer layer](../models.html#TransformerLayer).
       We make copies of it to make the transformer with `n_layers`.
      * `n_layers` is the number of [transformer layers](../models.html#TransformerLayer).
      * `patch_emb` is the [patch embeddings layer](#PatchEmbeddings).
      * `pos_emb` is the [positional embeddings layer](#LearnedPositionalEmbeddings).
      * `classification` is the [classification head](#ClassificationHead).
      """
      super().__init__()
      # Patch embeddings
      self.patch_emb = patch_emb
      self.pos_emb = pos_emb
      # Classification head
      self.classification = classification
      # Make copies of the transformer layer
      self.transformer_layers = clone_module_list(
          transformer_layer, n_layers
      )
  
      # `[CLS]` token embedding
      self.cls_token_emb = nn.Parameter(
          torch.randn(1, 1, transformer_layer.size), requires_grad=True
      )
      # Final normalization layer
      self.ln = nn.LayerNorm([transformer_layer.size])
  
imports: import torch
  from torch import nn
  from labml_helpers.module import Module
  from labml_nn.transformers import TransformerLayer
  from labml_nn.utils import clone_module_list
label_desc: Use image node_id 1 to create a new VisionTransformer object from inherited base classes: Module with example: obj = VisionTransformer(transformer_layer, n_layers, patch_emb, pos_emb, classification)