def simple_layer_stack(include_encdec_attention,
                       num_layers=6,
                       d_ff=2048,
                       num_heads=8,
                       d_kv=128,
                       dropout_rate=0.1):
  """Create a layer stack.

  Args:
    include_encdec_attention: a boolean
    num_layers: an integer
    d_ff: an integer
    num_heads: an integer
    d_kv: an integer
    dropout_rate: a float

  Returns:
    a LayerStack
  """
  ret = []
  for _ in xrange(num_layers):
    ret.append(
        transformer_layers.SelfAttention(
            num_heads=num_heads,
            key_value_size=d_kv,
            attention_kwargs={"dropout_rate": dropout_rate}))
    if include_encdec_attention:
      ret.append(
          transformer_layers.EncDecAttention(
              num_heads=num_heads,
              key_value_size=d_kv,
              attention_kwargs={"dropout_rate": dropout_rate}))
    ret.append(
        transformer_layers.DenseReluDense(
            hidden_size=d_ff,
            dropout_rate=dropout_rate))
  return transformer.LayerStack(ret)
Create a layer stack.

  Args:
    include_encdec_attention: a boolean
    num_layers: an integer
    d_ff: an integer
    num_heads: an integer
    d_kv: an integer
    dropout_rate: a float

  Returns:
    a LayerStack