parameters: (self,
                 num_units,
                 memory,
                 memory_sequence_length=None,
                 scale=False,
                 probability_fn=None,
                 score_mask_value=float("-inf"),
                 name="LuongAttention")
docstring: Construct the AttentionMechanism mechanism.
  
      Args:
        num_units: The depth of the attention mechanism.
        memory: The memory to query; usually the output of an RNN encoder.  This
          tensor should be shaped `[batch_size, max_time, ...]`.
        memory_sequence_length (optional): Sequence lengths for the batch entries
          in memory.  If provided, the memory tensor rows are masked with zeros
          for values past the respective sequence lengths.
        scale: Python boolean.  Whether to scale the energy term.
        probability_fn: (optional) A `callable`.  Converts the score to
          probabilities.  The default is @{tf.nn.softmax}. Other options include
          @{tf.contrib.seq2seq.hardmax} and @{tf.contrib.sparsemax.sparsemax}.
          Its signature should be: `probabilities = probability_fn(score)`.
        score_mask_value: (optional): The mask value for score before passing into
          `probability_fn`. The default is -inf. Only used if
          `memory_sequence_length` is not None.
        name: Name to use when creating ops.
docstring_summary: Construct the AttentionMechanism mechanism.
docstring_tokens: Construct the AttentionMechanism mechanism .
function: def __init__(self,
                 num_units,
                 memory,
                 memory_sequence_length=None,
                 scale=False,
                 probability_fn=None,
                 score_mask_value=float("-inf"),
                 name="LuongAttention"):
      """Construct the AttentionMechanism mechanism.
  
      Args:
        num_units: The depth of the attention mechanism.
        memory: The memory to query; usually the output of an RNN encoder.  This
          tensor should be shaped `[batch_size, max_time, ...]`.
        memory_sequence_length (optional): Sequence lengths for the batch entries
          in memory.  If provided, the memory tensor rows are masked with zeros
          for values past the respective sequence lengths.
        scale: Python boolean.  Whether to scale the energy term.
        probability_fn: (optional) A `callable`.  Converts the score to
          probabilities.  The default is @{tf.nn.softmax}. Other options include
          @{tf.contrib.seq2seq.hardmax} and @{tf.contrib.sparsemax.sparsemax}.
          Its signature should be: `probabilities = probability_fn(score)`.
        score_mask_value: (optional): The mask value for score before passing into
          `probability_fn`. The default is -inf. Only used if
          `memory_sequence_length` is not None.
        name: Name to use when creating ops.
      """
      # For LuongAttention, we only transform the memory layer; thus
      # num_units **must** match expected the query depth.
      if probability_fn is None:
        probability_fn = nn_ops.softmax
      wrapped_probability_fn = lambda score, _: probability_fn(score)
      super(LuongAttention, self).__init__(
          query_layer=None,
          memory_layer=layers_core.Dense(
              num_units, name="memory_layer", use_bias=False),
          memory=memory,
          probability_fn=wrapped_probability_fn,
          memory_sequence_length=memory_sequence_length,
          score_mask_value=score_mask_value,
          name=name)
      self._num_units = num_units
      self._scale = scale
      self._name = name
function_tokens: def __init__ ( self , num_units , memory , memory_sequence_length = None , scale = False , probability_fn = None , score_mask_value = float ( "-inf" ) , name = "LuongAttention" ) : # For LuongAttention, we only transform the memory layer; thus # num_units **must** match expected the query depth. if probability_fn is None : probability_fn = nn_ops . softmax wrapped_probability_fn = lambda score , _ : probability_fn ( score ) super ( LuongAttention , self ) . __init__ ( query_layer = None , memory_layer = layers_core . Dense ( num_units , name = "memory_layer" , use_bias = False ) , memory = memory , probability_fn = wrapped_probability_fn , memory_sequence_length = memory_sequence_length , score_mask_value = score_mask_value , name = name ) self . _num_units = num_units self . _scale = scale self . _name = name