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: Build a vanilla transformer layer.
docstr_tok: ["Build","a","vanilla","transformer","layer","."]
code: def vanilla_transformer_layer(self, context, x, mask):
      """Build a vanilla transformer layer."""
  
      for lnum, layer in enumerate(self._layers):
          scope_name = layer.name
          with tf.variable_scope(scope_name or ""):
              norm_x = self._layer_norm(
                  context, (x * mask) if mask else x
              )
              with tf.variable_scope(layer.__class__.__name__):
                  y = layer.call(context, norm_x)
                  if y.shape != x.shape:
                      raise ValueError(
                          "Layer %s returned misshaped output x=%s y=%s"
                          % (layer.__class__.__name__, x, y)
                      )
                  if self.use_gated_transformer:
                      y = self.gating(context, x, y, mask)
              x += self._dropout(context, y)
          if lnum != len(self._layers) - 1:
              context.layer_outputs.append(x)
          context.layer_index += 1
      return x
  
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 7 for calling the UTLayerStack obj's underlying member method code with example usage: obj.vanilla_transformer_layer(context, x, mask) and returns: x