class_docstr: A stack of layers for Universal Transformer.
  
  This implementation is largely adapted from t2t universal transformer
  implementation. Reference:
  third_party/py/tensor2tensor/models/research
class_docstr_tok: ["A","stack","of","layers","for","Universal","Transformer",".","This","implementation","is","largely","adapted","from","t2t","universal","transformer","implementation",".","Reference",":","third_party\/py\/tensor2tensor\/models\/research"]
docstr: Create a LayerStack for Universal Transformer.
  
  Args:
    layers: a list of TransformerLayer
    dropout_rate: a floating-point number
    norm_epsilon: a floating-point number
    num_vanilla_transformer_layers: number of vanilla transformer layers
      before the ACT layer.
    couple_carry_transform_gates: whether to couple carry and transform gates.
    act_type: act type
    recurrence_type: recurrence type (allowable values: "act").
    act_max_steps: maximum number of act steps
    act_epsilon: halting threshold
    num_rec_steps: maximum number of recurrent steps
    num_inrecurrence_layers: number of inrecurrence layers
    position_start_index: start index in embedding
    add_or_concat_timing_signal: bool,
    whether to add or concat the timing signal
    step_timing_signal_type: step timing signal type
    add_position_timing_signal: bool, whether to add position timing signal
    add_step_timing_signal: bool, whether to add step timing signal
    mix_with_transformer_before_ut: whether to mix transformer layers before
      ut.
    mix_with_transformer_after_ut: whether to mix transformer layers after ut.
    gates_inputs: controlling the cary/transform gate.
    gate_ffn_layer: gate ff layer type
    use_gated_transformer: whether to use gated transformer.
    gating_type: gating type.
docstr_tok: ["Create","a","LayerStack","for","Universal","Transformer",".","Args",":","layers",":","a","list","of","TransformerLayer","dropout_rate",":","a","floating-point","number","norm_epsilon",":","a","floating-point","number","num_vanilla_transformer_layers",":","number","of","vanilla","transformer","layers","before","the","ACT","layer",".","couple_carry_transform_gates",":","whether","to","couple","carry","and","transform","gates",".","act_type",":","act","type","recurrence_type",":","recurrence","type","(","allowable","values",":","``","act","''",")",".","act_max_steps",":","maximum","number","of","act","steps","act_epsilon",":","halting","threshold","num_rec_steps",":","maximum","number","of","recurrent","steps","num_inrecurrence_layers",":","number","of","inrecurrence","layers","position_start_index",":","start","index","in","embedding","add_or_concat_timing_signal",":","bool",",","whether","to","add","or","concat","the","timing","signal","step_timing_signal_type",":","step","timing","signal","type","add_position_timing_signal",":","bool",",","whether","to","add","position","timing","signal","add_step_timing_signal",":","bool",",","whether","to","add","step","timing","signal","mix_with_transformer_before_ut",":","whether","to","mix","transformer","layers","before","ut",".","mix_with_transformer_after_ut",":","whether","to","mix","transformer","layers","after","ut",".","gates_inputs",":","controlling","the","cary\/transform","gate",".","gate_ffn_layer",":","gate","ff","layer","type","use_gated_transformer",":","whether","to","use","gated","transformer",".","gating_type",":","gating","type","."]
code: def __init__(
      self,
      layers,
      dropout_rate=0.0,
      norm_epsilon=1e-6,
      num_vanilla_transformer_layers=2,
      couple_carry_transform_gates=True,
      act_type=gin.REQUIRED,
      recurrence_type=gin.REQUIRED,
      act_max_steps=gin.REQUIRED,
      act_epsilon=gin.REQUIRED,
      num_rec_steps=gin.REQUIRED,
      num_inrecurrence_layers=gin.REQUIRED,
      position_start_index=gin.REQUIRED,
      add_or_concat_timing_signal=gin.REQUIRED,
      step_timing_signal_type=gin.REQUIRED,
      add_position_timing_signal=gin.REQUIRED,
      add_step_timing_signal=gin.REQUIRED,
      mix_with_transformer_before_ut=gin.REQUIRED,
      mix_with_transformer_after_ut=gin.REQUIRED,
      gates_inputs=gin.REQUIRED,
      gate_ffn_layer=gin.REQUIRED,
      use_gated_transformer=gin.REQUIRED,
      gating_type=gin.REQUIRED,
  ):
      """Create a LayerStack for Universal Transformer.
  
      Args:
        layers: a list of TransformerLayer
        dropout_rate: a floating-point number
        norm_epsilon: a floating-point number
        num_vanilla_transformer_layers: number of vanilla transformer layers
          before the ACT layer.
        couple_carry_transform_gates: whether to couple carry and transform gates.
        act_type: act type
        recurrence_type: recurrence type (allowable values: "act").
        act_max_steps: maximum number of act steps
        act_epsilon: halting threshold
        num_rec_steps: maximum number of recurrent steps
        num_inrecurrence_layers: number of inrecurrence layers
        position_start_index: start index in embedding
        add_or_concat_timing_signal: bool,
        whether to add or concat the timing signal
        step_timing_signal_type: step timing signal type
        add_position_timing_signal: bool, whether to add position timing signal
        add_step_timing_signal: bool, whether to add step timing signal
        mix_with_transformer_before_ut: whether to mix transformer layers before
          ut.
        mix_with_transformer_after_ut: whether to mix transformer layers after ut.
        gates_inputs: controlling the cary/transform gate.
        gate_ffn_layer: gate ff layer type
        use_gated_transformer: whether to use gated transformer.
        gating_type: gating type.
      """
      self._layers = layers
      self._dropout_rate = dropout_rate
      self._norm_epsilon = norm_epsilon
      self.num_vanilla_transformer_layers = (
          num_vanilla_transformer_layers
      )
      self.act_type = act_type
      self.recurrence_type = recurrence_type
      self.act_max_steps = act_max_steps
      self.act_epsilon = act_epsilon
      self.num_rec_steps = num_rec_steps
      self.num_inrecurrence_layers = num_inrecurrence_layers
      self.position_start_index = position_start_index
      self.add_or_concat_timing_signal = add_or_concat_timing_signal
      self.step_timing_signal_type = step_timing_signal_type
      self.add_position_timing_signal = add_position_timing_signal
      self.add_step_timing_signal = add_step_timing_signal
      self.mix_with_transformer_before_ut = (
          mix_with_transformer_before_ut
      )
      self.mix_with_transformer_after_ut = mix_with_transformer_after_ut
      self.gates_inputs = gates_inputs
      self.gate_ffn_layer = gate_ffn_layer
      self.couple_carry_transform_gates = couple_carry_transform_gates
      self.use_gated_transformer = use_gated_transformer
      self.gating_type = gating_type
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import math
  import gin
  import mesh_tensorflow
  from mesh_tensorflow.transformer import transformer
  import tensorflow.compat.v1
label_desc: Use image node_id 1 to create a new UTLayerStack object from inherited base classes: transformer with example: obj = UTLayerStack(layers, dropout_rate, norm_epsilon, num_vanilla_transformer_layers, couple_carry_transform_gates, act_type, recurrence_type, act_max_steps, act_epsilon, num_rec_steps, num_inrecurrence_layers, position_start_index, add_or_concat_timing_signal, step_timing_signal_type, add_position_timing_signal, add_step_timing_signal, mix_with_transformer_before_ut, mix_with_transformer_after_ut, gates_inputs, gate_ffn_layer, use_gated_transformer, gating_type)