class_docstr: Transformer encoder.
class_docstr_tok: ["Transformer","encoder","."]
code: def __init__(
      self, args, dictionary, embed_tokens, proj_to_decoder=True
  ):
      super().__init__(dictionary)
      self.transformer_embedding = TransformerEmbedding(
          args=args, embed_tokens=embed_tokens
      )
  
      self.transformer_encoder_given_embeddings = (
          TransformerEncoderGivenEmbeddings(
              args=args, proj_to_decoder=proj_to_decoder
          )
      )
  
      # Variable tracker
      self.tracker = VariableTracker()
  
      # Initialize adversarial mode
      self.set_gradient_tracking_mode(False)
      self.set_embed_noising_mode(False)
  
imports: import math
  import random
  import torch
  import torch.nn
  import torch.nn.functional
  from fairseq import options, utils
  from fairseq.models import FairseqEncoder, FairseqEncoderDecoderModel, FairseqIncrementalDecoder, register_model, register_model_architecture, transformer
  from fairseq.modules import AdaptiveSoftmax, LayerNorm, MultiheadAttention, SinusoidalPositionalEmbedding
  from pytorch_translate import utils, vocab_reduction
  from pytorch_translate.average_attention import AverageAttention
  from pytorch_translate.common_layers import TransformerEmbedding, TransformerEncoderGivenEmbeddings, TransformerTokenEmbedding, VariableTracker
  from pytorch_translate.semi_supervised import SemiSupervisedModel
  from pytorch_translate.utils import torch_find
label_desc: Use image node_id 1 to create a new TransformerEncoder object from inherited base classes: FairseqEncoder with example: obj = TransformerEncoder(args, dictionary, embed_tokens, proj_to_decoder)