Git Product home page Git Product logo

pytorch-seq2seq-beam-search's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

pytorch-seq2seq-beam-search's Issues

Attention and Decoder Module hidden state question

Hi 312shan, great work!

I was analyzing your code and was curious about parts of the forward for the Decoder and Attention module.

. In the forward function of the Attention Module, you are doing
h = hidden.repeat(timestep, 1, 1).transpose(0, 1) # [32, 512]=>[32, 27, 512]
since you have passed the last layer of hidden state from Decoder's forward function as
attn_weights = self.attention(last_hidden[-1], encoder_outputs) # [32, 512][27, 32, 512]=>[32, 1, 27]

However, why is only the last of the hidden used? I'm assuming it's because of meeting matrix dimensionality requirements for the Attention Module, but lets say you specified multi-layers for the Decoder Module such as ,

decoder = Decoder(embed_size, hidden_size, en_size, n_layers=2, dropout=0.0)

Would this be losing half of information from the hidden state, that the Attention Module could have possibly used since you are only taking the last layer of the hidden state into account everytime?

Beam Search是怎么运用的?

您好,我最近在看您代码Seq2Seq中的BeamSearch,请问beam_decode函数返回的decoded_batch是怎么运用的?
我只在测试的代码中看到有调用,但是没看到有后续的操作了
image

decode 未 return

image

seq2seq.decode() 方法没return beam 或 greedy decode 的结果

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.