def call(self, inputs, state):
    """Run the cell and output projection on inputs, starting from state."""

    rnn_out, res_state = self._cell(inputs, state)

    # before dropout
    if self._use_copy:
      if self._reuse_attention:
        alignments = state.alignments
      else:
        scores = tf.squeeze(
            tf.matmul(self._encoder_emb, tf.expand_dims(rnn_out, axis=2)),
            axis=2)
        alignments = tf.nn.softmax(scores)

    if self._mode == tf_estimator.ModeKeys.TRAIN and self._dropout > 0.:
      rnn_out = tf.nn.dropout(rnn_out, keep_prob=1.-self._dropout)
    gen_logits = self._compute_logits(rnn_out)
    if self._use_copy:
      gen_prob = tf.nn.softmax(gen_logits, axis=-1)
      prob = self._compute_copy_prob(rnn_out, gen_prob, alignments)
      logits = tf.log(prob + self._eps)
    else:
      logits = gen_logits
    indices = tf.range(tf.shape(logits)[1])
    indices_mask = tf.zeros_like(indices, dtype=tf.float32) + self._vocab_offset
    negative_mask = tf.zeros_like(indices, dtype=tf.float32) - tf.constant(1e+8)
    zero_mask = tf.zeros_like(indices, dtype=tf.float32)
    bias = tf.where(tf.greater_equal(tf.cast(indices, dtype=tf.float32),
                                     indices_mask),
                    negative_mask, zero_mask)
    logits = logits + bias
    return logits, res_state
Run the cell and output projection on inputs, starting from state.
language/labs/exemplar_decoding/models/output_wrapper.py