'Create a cell with attention.
Args:
cell: an RNNCell, an attention is added to it.
attn_states: External attention states typically the encoder output in the
form [batch_size, time steps, hidden size]
attn_vec_size: integer, the number of convolutional features calculated
on attention state and a size of the hidden layer built from
base cell state. Equal attn_size to by default.
input_size: integer, the size of a hidden linear layer,
built from inputs and attention. Derived from the input tensor
by default.
state_is_tuple: If True, accepted and returned states are n-tuples, where
`n = len(cells)`.  Must be set to True else will raise an exception
concatenated along the column axis.
reuse: (optional) Python boolean describing whether to reuse variables
in an existing scope.  If not `True`, and the existing scope already has
the given variables, an error is raised.
Raises:
TypeError: if cell is not an RNNCell.
ValueError: if the flag `state_is_tuple` is `False` or if shape of
`attn_states` is not 3 or if innermost dimension (hidden size) is None.'

def __init__(self, cell, attn_states, attn_vec_size=None, input_size=None, state_is_tuple=True, reuse=None):

    super(ExternalAttentionCellWrapper, self).__init__(_reuse=reuse)
    if (not state_is_tuple):
        raise ValueError('Only    tuple    state    is    supported')
    self._cell = cell
    self._input_size = input_size
    attn_shape = attn_states.get_shape()
    if ((not attn_shape) or (len(attn_shape) != 3)):
        raise ValueError('attn_shape    must    be    rank    3')
    self._attn_states = attn_states
    self._attn_size = attn_shape[2].value
    if (self._attn_size is None):
        raise ValueError('Hidden    size    of    attn_states    cannot    be    None')
    self._attn_vec_size = attn_vec_size
    if (self._attn_vec_size is None):
        self._attn_vec_size = self._attn_size
    self._reuse = reuse
