class_docstr: Attention net.  See file docstring.
docstr: Parse the layer string.
  
  Returns:
    list[tuple[str, str]]: Encoder layers: list of (attention, feed-forward)
    list[tuple[str, str, str]]: Decoder layers: list of (self-attention,
      enc-dec attention, feed-forward)
docstr_tok: ["Parse","the","layer","string",".","Returns",":","list","[","tuple","[","str",",","str","]","]",":","Encoder","layers",":","list","of","(","attention",",","feed-forward",")","list","[","tuple","[","str",",","str",",","str","]","]",":","Decoder","layers",":","list","of","(","self-attention",",","enc-dec","attention",",","feed-forward",")"]
code: def _extract_layer_types(self):
      """Parse the layer string.
  
      Returns:
        list[tuple[str, str]]: Encoder layers: list of (attention, feed-forward)
        list[tuple[str, str, str]]: Decoder layers: list of (self-attention,
          enc-dec attention, feed-forward)
      """
      hparams = self._hparams
      layer_types = hparams.layer_types
  
      # If the architecture has not explicitly been set, we just construct a
      # standard transformer with the fallback values
      if not layer_types:
          layer_types = SEP_LAYER.join(
              [hparams.default_att] * hparams.num_hidden_layers
          )
  
      # If encoder not explicitly defined, the encoder will have the same
      # structure as the decoder
      layer_types = layer_types.split(SEP_ENCODEC)
      if len(layer_types) == 1:
          layer_types *= 2
  
      # Some models don't need the encoder (ex: language modeling)
      # TODO(epot): What are the other conditions (has_input ?)
      if hparams.prepend_mode != "none":
          layer_types[0] = ""
  
      # Extend the blocks and fill them with the default values if not specified
      final_layers = ([], [])
      for i, blocks_str_joined in enumerate(layer_types):
          for blocks_str in blocks_str_joined.split(SEP_LAYER):
              if not blocks_str:
                  continue
              blocks_list = blocks_str.split(SEP_FF)
              # Eventually use the fallback values for the layer_types. If the
              # encoder is empty, do not use the enco-deco attention.
              self_att = blocks_list[0] or hparams.default_att
              ende_att = hparams.default_att if layer_types[0] else "_"
              ff = hparams.default_ff
              if len(blocks_list) > 1:
                  ff = blocks_list[-1]
              if len(blocks_list) == 3:
                  ende_att = blocks_list[1]
              if i == 0:  # Encoder
                  blocks_tuple = (self_att, ff)
              elif i == 1:  # Decoder
                  blocks_tuple = (self_att, ende_att, ff)
              final_layers[i].append(blocks_tuple)
  
      return final_layers
  
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_hparams
  from tensor2tensor.layers import common_layers
  from tensor2tensor.models import transformer
  from tensor2tensor.utils import expert_utils
  from tensor2tensor.utils import registry
  from tensor2tensor.utils import t2t_model
  import tensorflow.compat.v1
  from tensorflow.compat.v1 import estimator
label_desc: Use image node_id 5 for calling the TransformerMoe obj's underlying member method code with example usage: obj._extract_layer_types() and returns: final_layers