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: get n-dimensional embedding as the layer (vertical) timing signal.
  
  Adds embeddings to represent the position of the layer in the tower.
  
  Args:
    context: mtf context
    channels: dimension of the timing signal
    layer: layer num
    num_layers: total number of layers
  
  Returns:
    a Tensor of timing signals [channels].
docstr_tok: ["get","n-dimensional","embedding","as","the","layer","(","vertical",")","timing","signal",".","Adds","embeddings","to","represent","the","position","of","the","layer","in","the","tower",".","Args",":","context",":","mtf","context","channels",":","dimension","of","the","timing","signal","layer",":","layer","num","num_layers",":","total","number","of","layers","Returns",":","a","Tensor","of","timing","signals","[","channels","]","."]
code: def get_layer_timing_signal_learned_1d(
      self, context, channels, layer, num_layers
  ):
      """get n-dimensional embedding as the layer (vertical) timing signal.
  
      Adds embeddings to represent the position of the layer in the tower.
  
      Args:
        context: mtf context
        channels: dimension of the timing signal
        layer: layer num
        num_layers: total number of layers
  
      Returns:
        a Tensor of timing signals [channels].
      """
      layer_dim = mtf.Dimension("layer", num_layers)
      shape = mtf.Shape([layer_dim, channels])
      layer_embedding = mtf.get_variable(
          context.mesh,
          "layer_embedding",
          shape,
          dtype=context.variable_dtype,
          initializer=tf.random_normal_initializer(
              0, channels.size**-0.5
          ),
      ) * (channels.size**0.5)
      return mtf.gather(layer_embedding, layer, layer_dim)
  
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 4 for calling the UTLayerStack obj's underlying member method code with example usage: obj.get_layer_timing_signal_learned_1d(context, channels, layer, num_layers) and returns: mtf