625451ab74f1942eb951337554d72005076a51b3,onmt/Trainer.py,Trainer,validate,#Trainer#,148

Before Change


        stats = Statistics()

        for batch in self.valid_iter:
            if hasattr(batch, "src"):
                _, src_lengths = batch.src
                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 = onmt.IO.make_features(batch, "tgt")

            // F-prop through the model.
            outputs, attns, _ = self.model(src, tgt, src_lengths)

After Change



        for batch in self.valid_iter:
            src = onmt.IO.make_features(batch, "src", self.data_type)
            if self.data_type == "text":
                _, src_lengths = batch.src
            else:
                src_lengths = None

            tgt = onmt.IO.make_features(batch, "tgt")

            // F-prop through the model.
            outputs, attns, _ = self.model(src, tgt, src_lengths)
Italian Trulli
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: validate


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/Translator.py
Class Name: Translator
Method Name: translateBatch


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