【问题标题】:Is that possible to implement Dynamic RNN with Attention by TensorFlow?是否可以通过 TensorFlow 实现带注意力的动态 RNN?
【发布时间】:2016-10-04 09:53:23
【问题描述】:

是否有可能实现带注意力的动态 RNN 而不是 TensorFlow 的分桶?

如果没有,我们应该如何实现?

非常感谢。

【问题讨论】:

  • 仅供参考,这篇文章似乎对这个主题进行了彻底的处理。 wildml.com/2016/08/…
  • 这个没有给出Attention Mechanism的例子,但是非常感谢。

标签: python tensorflow deep-learning recurrent-neural-network


【解决方案1】:

使用tf.contrib.rnn.AttentionCellWrapper

例子:

cell_with_attention = tf.contrib.rnn.AttentionCellWrapper(cell, attn_length, ...)
outputs, state = tf.nn.dynamic_rnn(cell_with_attention, inputs, ...)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-02-03
    • 1970-01-01
    • 1970-01-01
    • 2015-02-13
    • 1970-01-01
    • 1970-01-01
    • 2017-03-28
    • 2018-03-17
    相关资源
    最近更新 更多