625451ab74f1942eb951337554d72005076a51b3,onmt/Trainer.py,Trainer,train,#Trainer#Any#Any#,95
Before Change
trunc_size = self.trunc_size if self.trunc_size else target_size
dec_state = None
if hasattr(batch, "src"):
_, src_lengths = batch.src
report_stats.n_src_words += src_lengths.sum()
src = onmt.IO.make_features(batch, "src")
elif hasattr(batch, "src_img"):
src = onmt.IO.make_features(batch, "src_img")
src_lengths = None
elif hasattr(batch, "src_audio"):
src = onmt.IO.make_features(batch, "src_audio")
src_lengths = None
tgt_outer = onmt.IO.make_features(batch, "tgt")
for j in range(0, target_size-1, trunc_size):
// 1. Create truncated target.
After Change
dec_state = None
src = onmt.IO.make_features(batch, "src", self.data_type)
if self.data_type == "text":
_, src_lengths = batch.src
report_stats.n_src_words += src_lengths.sum()
else:
src_lengths = None
tgt_outer = onmt.IO.make_features(batch, "tgt")
for j in range(0, target_size-1, trunc_size):
// 1. Create truncated target.
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 12
Instances
Project Name: OpenNMT/OpenNMT-py
Commit Name: 625451ab74f1942eb951337554d72005076a51b3
Time: 2017-12-12
Author: dengyuntian@gmail.com
File Name: onmt/Trainer.py
Class Name: Trainer
Method Name: train
Project Name: OpenNMT/OpenNMT-py
Commit Name: 625451ab74f1942eb951337554d72005076a51b3
Time: 2017-12-12
Author: dengyuntian@gmail.com
File Name: onmt/Trainer.py
Class Name: Trainer
Method Name: train
Project Name: OpenNMT/OpenNMT-py
Commit Name: 625451ab74f1942eb951337554d72005076a51b3
Time: 2017-12-12
Author: dengyuntian@gmail.com
File Name: onmt/Trainer.py
Class Name: Trainer
Method Name: validate
Project Name: OpenNMT/OpenNMT-py
Commit Name: 625451ab74f1942eb951337554d72005076a51b3
Time: 2017-12-12
Author: dengyuntian@gmail.com
File Name: onmt/Translator.py
Class Name: Translator
Method Name: translateBatch