注意力权重计算为:
我想知道h_s指的是什么。
在 tensorflow 代码中,编码器 RNN 返回一个元组:
encoder_outputs, encoder_state = tf.nn.dynamic_rnn(...)
正如我所想,h_s应该是encoder_state,但是github/nmt给出了不同的答案?
# attention_states: [batch_size, max_time, num_units]
attention_states = tf.transpose(encoder_outputs, [1, 0, 2])
# Create an attention mechanism
attention_mechanism = tf.contrib.seq2seq.LuongAttention(
num_units, attention_states,
memory_sequence_length=source_sequence_length)
我误解了代码吗?或者h_s实际上意味着encoder_outputs?


