class_docstr: Sequence-to-sequence dynamic model with attention.
  
  This class implements a multi-layer recurrent neural network as encoder,
  and an attention-based decoder. This is the same as the model described in
  (Luong et al., EMNLP'2015) paper: https://arxiv.org/pdf/1508.04025v5.pdf.
  This class also allows to use GRU cells in addition to LSTM cells with
  support for dropout.
code: def __init__(
      self,
      hparams,
      mode,
      iterator,
      source_vocab_table,
      target_vocab_table,
      reverse_target_vocab_table=None,
      scope=None,
      extra_args=None,
  ):
      self.has_attention = (
          hparams.attention_architecture and hparams.attention
      )
  
      # Set attention_mechanism_fn
      if self.has_attention:
          if extra_args and extra_args.attention_mechanism_fn:
              self.attention_mechanism_fn = (
                  extra_args.attention_mechanism_fn
              )
          else:
              self.attention_mechanism_fn = create_attention_mechanism
  
      super(AttentionModel, self).__init__(
          hparams=hparams,
          mode=mode,
          iterator=iterator,
          source_vocab_table=source_vocab_table,
          target_vocab_table=target_vocab_table,
          reverse_target_vocab_table=reverse_target_vocab_table,
          scope=scope,
          extra_args=extra_args,
      )
  
file_path: nlp-architect/examples/sparse_gnmt/gnmt/attention_model.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import tensorflow
  from .None import model
  from .None import model_helper
label_desc: Use image node_id 1 to create a new AttentionModel object from inherited base classes: model with example: obj = AttentionModel(hparams, mode, iterator, source_vocab_table, target_vocab_table, reverse_target_vocab_table, scope, extra_args)