class_docstr: Transformer Autoencoder, which uses a single performance encoding.
class_docstr_tok: ["Transformer","Autoencoder",",","which","uses","a","single","performance","encoding","."]
docstr: Encode transformer inputs, see transformer_encode.
docstr_tok: ["Encode","transformer","inputs",",","see","transformer_encode","."]
code: def encode(
      self, inputs, target_space, hparams, features=None, losses=None
  ):
      """Encode transformer inputs, see transformer_encode."""
      return perf_transformer_encode(
          self._encoder_function,
          inputs,
          target_space,
          hparams,
          baseline=False,
          attention_weights=self.attention_weights,
          features=features,
          losses=losses,
          prepare_encoder_fn=self._prepare_encoder_fn,
      )
  
imports: from tensor2tensor.data_generators import text_encoder
  from tensor2tensor.layers import common_attention
  from tensor2tensor.layers import common_layers
  from tensor2tensor.layers import modalities
  from tensor2tensor.layers import transformer_layers
  from tensor2tensor.models.transformer import Transformer, transformer_decoder, transformer_prepare_encoder, transformer_prepare_decoder, features_to_nonpadding, _init_transformer_cache
  from tensor2tensor.utils import mlperf_log
  from tensor2tensor.utils import registry
  import tensorflow.compat.v1
  from tensorflow.compat.v1 import estimator
label_desc: Use image node_id 2 for calling the PerformanceTransformer obj's underlying member method code with example usage: obj.encode(inputs, target_space, hparams, features, losses) and returns: perf_transformer_encode