5 ms·
In neural translation seq2seq, using while_loop in the decoder RNN saves a lot of GPU time because it can quit early when a sentence ends.
by greato 9y ago
In neural translation seq2seq, using while_loop in the decoder RNN saves a lot of GPU time because it can quit early when a sentence ends.
- fdrdrive 9y agoI see - you're talking about a use case like this: https://github.com/google/seq2seq/blob/4c3582741f846a19195ac62a5867cfc90a9aa903/seq2seq/contrib/seq2seq/decoder.py#L279-L288 https://github.com/google/seq2seq/blob/4c3582741f846a19195ac... I agree that you have to use a tf.while_loop in those cases. But then tf.scan isn't an option, so I don't understand what you mean by 'quit early' or 'saves time'. When tf.scan is possible, i.e. when you have an input sequence you want to scan over, it is a perfectly good option.