class_docstr: Transformer encoder.
class_docstr_tok: ["Transformer","encoder","."]
code: def forward(self, src_tokens, src_lengths):
      # Initialize the tracker to keep track of internal variables
      self.tracker.reset()
      x, encoder_padding_mask, positions = self.transformer_embedding(
          src_tokens=src_tokens, src_lengths=src_lengths
      )
      # Track token embeddings
      self.tracker.track(
          x, "token_embeddings", retain_grad=self.track_gradients
      )
  
      x = self.transformer_encoder_given_embeddings(
          x=x,
          positions=positions,
          encoder_padding_mask=encoder_padding_mask,
      )
  
      # TODO(jamesreed): this is kinda a hack because we can't annotate an
      # Optional[Tensor] output for encoder_padding_mask
      if encoder_padding_mask is None:
          encoder_padding_mask = torch.empty([])
  
      return x, src_tokens, encoder_padding_mask
  
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 2 for calling the TransformerEncoder obj's underlying member method code with example usage: obj.forward(src_tokens, src_lengths) and returns: x,  src_tokens,  encoder_padding_mask