class_docstr: Sequence2Sequence model with attention mechanism.
  
  Args:
    source_vocab_info: An instance of `VocabInfo`
      for the source vocabulary
    target_vocab_info: An instance of `VocabInfo`
      for the target vocabulary
    params: A dictionary of hyperparameters
class_docstr_tok: ["Sequence2Sequence","model","with","attention","mechanism",".","Args",":","source_vocab_info",":","An","instance","of","`","VocabInfo","`","for","the","source","vocabulary","target_vocab_info",":","An","instance","of","`","VocabInfo","`","for","the","target","vocabulary","params",":","A","dictionary","of","hyperparameters"]
code: def _create_decoder(self, encoder_output, features, _labels):
      attention_class = locate(
          self.params["attention.class"]
      ) or getattr(decoders.attention, self.params["attention.class"])
      attention_layer = attention_class(
          params=self.params["attention.params"], mode=self.mode
      )
  
      # If the input sequence is reversed we also need to reverse
      # the attention scores.
      reverse_scores_lengths = None
      if self.params["source.reverse"]:
          reverse_scores_lengths = features["source_len"]
          if self.use_beam_search:
              reverse_scores_lengths = tf.tile(
                  input=reverse_scores_lengths,
                  multiples=[
                      self.params["inference.beam_search.beam_width"]
                  ],
              )
  
      return self.decoder_class(
          params=self.params["decoder.params"],
          mode=self.mode,
          vocab_size=self.target_vocab_info.total_size,
          attention_values=encoder_output.attention_values,
          attention_values_length=encoder_output.attention_values_length,
          attention_keys=encoder_output.outputs,
          attention_fn=attention_layer,
          reverse_scores_lengths=reverse_scores_lengths,
      )
  
file_path: seq2seq/seq2seq/models/attention_seq2seq.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from __future__ import unicode_literals
  from pydoc import locate
  import tensorflow
  from seq2seq import decoders
  from seq2seq.models.basic_seq2seq import BasicSeq2Seq
label_desc: Use image node_id 3 for calling the AttentionSeq2Seq obj's underlying member method code with example usage: obj._create_decoder(encoder_output, features, _labels) and returns: self