def __init__(self, cell, num_layers, hidden_dim, output_size,
               weights=None,
               activation=tf.tanh,
               dropout=0.,
               use_copy=False,
               encoder_emb=None,
               sparse_inputs=None,
               mask=None,
               hps=None,
               mode=tf_estimator.ModeKeys.EVAL,
               reuse=None):
    """Create a cell with output projection.

    Args:
      cell: an RNNCell, a projection to output_size is added to it.
      num_layers: number of MLP layers.
      hidden_dim: hidden size of the MLP.
      output_size: integer, the size of the output after projection.
      weights: (optional) a specified tensor.
      activation: (optional) an optional activation function.
      dropout: dropout rate for dropout at the output layer.
      use_copy: Use copy mechanism or not.
      encoder_emb: Outputs of the encoder.
      sparse_inputs: Sparse inputs.
      mask: mask.
      hps: Hyperparameters.
      mode: train/eval.
      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 output_size is not positive.
    """
    super(OutputWrapper, self).__init__(_reuse=reuse)
    if output_size < 1:
      raise ValueError("Parameter output_size must be > 0: %d." % output_size)
    self._cell = cell
    self._num_layers = num_layers
    self._activation = activation
    self._weights = weights
    if self._weights is None:
      self._output_size = output_size
    else:
      self._output_size = tensor_utils.shape(self._weights, 1)

    self._hidden_dim = hidden_dim
    self._dropout = dropout
    self._reuse = reuse
    self._mode = None
    self._sigmoid = tf.sigmoid
    self._linear1, self._linear2, self._linear_copy = None, None, None
    assert self._num_layers <= 2
    self._use_copy = use_copy
    self._encoder_emb = encoder_emb
    self._sparse_inputs, self._mask = sparse_inputs, mask
    self._mode = mode
    self._reuse_attention = hps.reuse_attention
    if self._use_copy:
      assert self._sparse_inputs is not None
      assert self._mask is not None
      if not self._reuse_attention:
        assert self._encoder_emb is not None
        encoder_dim = tf.shape(self._encoder_emb)[-1]
        if encoder_dim != self._hidden_dim:
          assert False
    self._eps = 1e-8
    self._vocab_offset = hps.output_size
Create a cell with output projection.

    Args:
      cell: an RNNCell, a projection to output_size is added to it.
      num_layers: number of MLP layers.
      hidden_dim: hidden size of the MLP.
      output_size: integer, the size of the output after projection.
      weights: (optional) a specified tensor.
      activation: (optional) an optional activation function.
      dropout: dropout rate for dropout at the output layer.
      use_copy: Use copy mechanism or not.
      encoder_emb: Outputs of the encoder.
      sparse_inputs: Sparse inputs.
      mask: mask.
      hps: Hyperparameters.
      mode: train/eval.
      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 output_size is not positive.
    
language/labs/exemplar_decoding/models/output_wrapper.py