class_docstr: Implementation of the Transformer Sentence Encoder. This directly makes
  use of the TransformerSentenceEncoder module in Fairseq.
  
  A few interesting config options:
      - encoder_normalize_before detemines whether the layer norm is applied
        before or after self_attention. This is similar to original
        implementation from Google.
      - activation_fn can be set to 'gelu' instead of the default of 'relu'.
code: def _encoder(
      self, input_tuple: Tuple[torch.Tensor, ...]
  ) -> Tuple[torch.Tensor, ...]:
      tokens, _, segment_labels, positions = input_tuple
      if self.offset_positions_by_padding or (not self.multilingual):
          positions = None
  
      if self.use_torchscript and self.traced_encoder is None:
          self.traced_encoder = TracedTransformerEncoder(
              self.sentence_encoder, tokens, segment_labels, positions
          )
          del self.sentence_encoder
          self.sentence_encoder = self.traced_encoder
          print("Using traced transformer sentence encoder")
  
      encoded_layers, pooled_output = self.sentence_encoder(
          tokens, segment_labels, positions=positions
      )
      # Each tensor in encoded_layers output by the Fairseq module has
      # the shape: T x B x C. Convert this to B x T x C
      encoded_layers = [x.transpose(0, 1) for x in encoded_layers]
      return encoded_layers, pooled_output
  
file_path: pytext/pytext/models/representations/transformer_sentence_encoder.py
imports: from typing import Tuple
  import torch
  from fairseq.modules import TransformerSentenceEncoder
  from pytext.config import ConfigBase
  from pytext.models.representations.traced_transformer_encoder import TracedTransformerEncoder
  from pytext.models.representations.transformer_sentence_encoder_base import TransformerSentenceEncoderBase
  from pytext.utils.usage import log_class_usage
label_desc: Use image node_id 3 for calling the TransformerSentenceEncoder obj's underlying member method code with example usage: obj._encoder(input_tuple) and returns: encoded_layers,  pooled_output