6aad1de658a933d3fa376f7fe9abf419da8a8bd2,python/baseline/pytorch/classify/train.py,ClassifyTrainerPyTorch,_test,#ClassifyTrainerPyTorch#Any#,32
Before Change
loss = self.crit(pred, y)
total_loss += loss.item()
_add_to_cm(cm, y, pred)
pg.update()
pg.done()
metrics = cm.get_all_metrics()
metrics["avg_loss"] = total_loss/float(steps)
verbose_output(verbose, cm)
After Change
cm = ConfusionMatrix(self.labels)
verbose = kwargs.get("verbose", None)
for batch_dict in pg(loader):
example = self._make_input(batch_dict)
y = example.pop("y")
pred = self.model(example)
loss = self.crit(pred, y)
batchsz = self._get_batchsz(batch_dict)
total_loss += loss.item() * batchsz
total_norm += batchsz
_add_to_cm(cm, y, pred)
metrics = cm.get_all_metrics()
metrics["avg_loss"] = total_loss / float(total_norm)
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 6
Instances
Project Name: dpressel/mead-baseline
Commit Name: 6aad1de658a933d3fa376f7fe9abf419da8a8bd2
Time: 2018-11-26
Author: blester125@users.noreply.github.com
File Name: python/baseline/pytorch/classify/train.py
Class Name: ClassifyTrainerPyTorch
Method Name: _test
Project Name: dpressel/mead-baseline
Commit Name: 6aad1de658a933d3fa376f7fe9abf419da8a8bd2
Time: 2018-11-26
Author: blester125@users.noreply.github.com
File Name: python/baseline/pytorch/seq2seq/train.py
Class Name: Seq2SeqTrainerPyTorch
Method Name: test
Project Name: dpressel/mead-baseline
Commit Name: 6aad1de658a933d3fa376f7fe9abf419da8a8bd2
Time: 2018-11-26
Author: blester125@users.noreply.github.com
File Name: python/baseline/tf/classify/train.py
Class Name: ClassifyTrainerTf
Method Name: _test