def layer_norm(input_tensor, name=None):
  """Run layer normalization on the last dimension of the tensor."""
  return tf.contrib.layers.layer_norm(
      inputs=input_tensor, begin_norm_axis=-1, begin_params_axis=-1, scope=name,
      variables_collections=["layer_norm", tf.GraphKeys.GLOBAL_VARIABLES])
Run layer normalization on the last dimension of the tensor.
modeling.py