Git Product home page Git Product logo

tensorflow_note's Introduction

TensorFlow_note

tensorflow学习笔记

tensorflow_note's People

Contributors

libcorner avatar

Stargazers

Robert avatar  avatar  avatar fun_dl avatar

Watchers

James Cloos avatar  avatar

Forkers

chapzq77

tensorflow_note's Issues

关于attention代码的问题

非常感谢你的笔记!

我看到您对于Attention Wrappers的计算过程进行了总结:

每个时刻的基本计算过程为:
1) cell_inputs = concat([inputs, prev_state.attention], -1) #inputs与attention结合
2) cell_output, next_cell_state = cell(cell_inputs, prev_state.cell_state) #rnncell的输出
3) score = attention_mechanism(cell_output) #计算attention得分
4) alignments = softmax(score)

我查看了TensorFlow的源码,https://github.com/tensorflow/tensorflow/blob/r1.5/tensorflow/contrib/seq2seq/python/ops/attention_wrapper.py 其中第1325行和1353行应该分别对应你的第2. 3两点。但是我对此有些疑问,我认为attention机制时输入应该是Decoder的第i-1阶段的隐状态和Encoder第j个阶段的隐状态,但是您的第(3)点(也就是源码的第1353行)是将cell_output而不是next_cell_output传入attention_mechanism,这让我感觉很困惑。根据论文以及我查到的其他一些资料(如https://zhuanlan.zhihu.com/p/28054589http://blog.csdn.net/qq_21190081/article/details/53083516 ),都是利用Encoder的隐状态而非Encoder的输出来做attention的,我也在tensorflow/tensorflow#16287 看到有人提出了相同的问题。不知您能否解决我的困惑。非常感谢!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.