class_docstr: The Evolved Transformer from arxiv.org/abs/1901.11117 .
class_docstr_tok: ["The","Evolved","Transformer","from","arxiv.org\/abs\/1901.11117","."]
code: def __init__(self, *args, **kwargs):
      super(EvolvedTransformer, self).__init__(*args, **kwargs)
      self._encoder_function = evolved_transformer_encoder
      self._decoder_function = evolved_transformer_decoder
      self._init_cache_fn = init_evolved_transformer_cache
  
      # -1 means train all weights.
      if self.hparams.get("num_trainable_top_decoder_layers", -1) < 0:
          t2t_model.log_info(
              "num_trainable_top_decoder_layers is negative so training all weights."
          )
      elif self.hparams.shared_embedding_and_softmax_weights:
          t2t_model.log_info(
              "Setting hparams.shared_embedding_and_softmax_weights to False, "
              "because hparam.num_trainable_top_decoder_layers is being used."
          )
  
          # When hparam.num_trainable_top_decoder_layers is set to N >= 0 we will
          # freeze (not train) every variable except the N top decoder layers and
          # the (pre-)softmax matrix. For any N >= 0 we will freeze the encoder and
          # input/target embeddings. This also means we will not share the
          # (pre-)softmax matrix with input/target embeddings otherwise they will be
          # trained as well.
          self.hparams.shared_embedding_and_softmax_weights = False
  
          # If hparams.shared_embedding_and_softmax_weights was previously True,
          # then input and target embeddings were being shared.
          # To make sure it they embeddings continue to be shared, we need to set
          # hparams.shared_embedding to True.
          self.hparams.shared_embedding = True
      self._init_cache_fn = init_evolved_transformer_cache
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from tensor2tensor.layers import common_attention
  from tensor2tensor.layers import common_layers
  from tensor2tensor.models import transformer
  from tensor2tensor.utils import registry
  from tensor2tensor.utils import t2t_model
  import tensorflow.compat.v1
  from tensorflow.python.ops import inplace_ops
label_desc: Use image node_id 1 to create a new EvolvedTransformer object from inherited base classes: transformer with example: obj = EvolvedTransformer()