code: def __init__(
      self,
      eager_encoder: TransformerSentenceEncoderModule,
      tokens: torch.Tensor,
      segment_labels: torch.Tensor = None,
      positions: torch.Tensor = None,
      token_embeddings: torch.Tensor = None,
      attn_mask: torch.Tensor = None,
  ) -> None:
      super().__init__()
      traceable_encoder = TraceableTransformerWrapper(eager_encoder)
      traced_encoder_inputs = self._prepare_inputs(
          tokens, segment_labels, positions, token_embeddings, attn_mask
      )
      self.has_segment_labels = segment_labels is not None
      self.has_positions = positions is not None
  
      self.iter_ = 0
  
      # do not check trace because of non-deterministic ops (e.g. dropout)
      self.traced_encoder = torch.jit.trace(
          traceable_encoder,
          tuple(traced_encoder_inputs),
          check_trace=False,
      )
      if torch.cuda.is_available():
          try:
              import torch_tvm
  
              torch_tvm.enable(
                  device_type="gpu",
                  device="cuda",
                  device_id=torch.cuda.current_device(),
                  is_training=True,
              )
              print("Using TVM in traced transformer")
          except ImportError:
              print("Not using TVM in traced transformer")
      log_class_usage(__class__)
  
file_path: pytext/pytext/models/representations/traced_transformer_encoder.py
imports: from typing import Tuple
  import torch
  import torch.cuda
  import torch.nn
  from fairseq.modules import TransformerSentenceEncoder
  from pytext.utils.usage import log_class_usage
label_desc: Use image node_id 1 to create a new TracedTransformerEncoder object from inherited base classes: nn with example: obj = TracedTransformerEncoder(eager_encoder, tokens, segment_labels, positions, token_embeddings, attn_mask)