class_docstr: Latent depth (https://arxiv.org/abs/2009.13102) implemented in
  TransformerEncoder.
class_docstr_tok: ["Latent","depth","(","https",":","\/\/arxiv.org\/abs\/2009.13102",")","implemented","in","TransformerEncoder","."]
code: def __init__(self, args, dictionary, embed_tokens, num_logits=1):
      self.num_logits = num_logits
      self.num_layers = args.encoder_layers
      super().__init__(args, dictionary, embed_tokens)
      self.layer_select = LayerSelect(
          num_layers=self.num_layers,
          num_logits=self.num_logits,
          soft_select=getattr(args, "soft_select", False),
          sampling_tau=getattr(args, "sampling_tau", 5.0),
      )
      self.lang_idx = None
      self.layers = nn.ModuleList(
          [
              self._build_encoder_layer(args, idx)
              for idx in range(args.encoder_layers)
          ]
      )
  
imports: from typing import Any, Dict, Optional
  import torch.nn
  from fairseq.models.fairseq_encoder import EncoderOut
  from fairseq.models.transformer import TransformerDecoder, TransformerEncoder
  from fairseq.modules import TransformerDecoderLayer, TransformerEncoderLayer
  from torch import Tensor
  from ..modules.latent_layers import LayerSelect
label_desc: Use image node_id 1 to create a new LatentTransformerEncoder object from inherited base classes: TransformerEncoder with example: obj = LatentTransformerEncoder(args, dictionary, embed_tokens, num_logits)