3a71ecffa3a8aff931a0ff865434e11e8ea08ba3,onmt/translate/translator.py,Translator,_fast_translate_batch,#Translator#Any#Any#Any#Any#Any#Any#,328
Before Change
results["predictions"][b].append(pred)
results["attention"][b].append(
attn if attn is not None else [])
non_finished = end_condition.eq(0).nonzero().view(-1)
// If all sentences are translated, no need to go further.
if len(non_finished) == 0:
break
// Remove finished batches for the next step.
After Change
memory_bank = tile(memory_bank, beam_size, dim=1)
memory_lengths = tile(src_lengths, beam_size)
top_beam_finished = torch.zeros([batch_size], dtype=torch.uint8)
batch_offset = torch.arange(batch_size, dtype=torch.long)
beam_offset = torch.arange(
0,
batch_size * beam_size,
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 4
Instances Project Name: OpenNMT/OpenNMT-py
Commit Name: 3a71ecffa3a8aff931a0ff865434e11e8ea08ba3
Time: 2018-10-22
Author: guillaume.klein@systrangroup.com
File Name: onmt/translate/translator.py
Class Name: Translator
Method Name: _fast_translate_batch
Project Name: asappresearch/sru
Commit Name: faf3aa876462323f2fa721ebd633752d6489808f
Time: 2020-09-18
Author: taolei@csail.mit.edu
File Name: sru/modules.py
Class Name: SRU
Method Name: forward
Project Name: catalyst-team/catalyst
Commit Name: f93beff338925cc1bf1b3ff1b32a2c440a4c9427
Time: 2020-04-21
Author: scitator@gmail.com
File Name: tests/_tests_scripts/z_mvp_mnist_gan.py
Class Name: CustomRunner
Method Name: _handle_batch