0a456a7582da2ab4271756d7775bba84a75c8c0d,allennlp/training/metrics/categorical_accuracy.py,CategoricalAccuracy,__call__,#CategoricalAccuracy#Any#Any#Any#,35
Before Change
if mask is not None:
correct *= mask.view(-1, 1)
self.total_count += mask.sum()
else:
self.total_count += gold_labels.numel()
self.correct_count += correct.sum()
if is_distributed():
_correct_count = torch.tensor(self.correct_count).to(device)
_total_count = torch.tensor(self.total_count).to(device)
dist.all_reduce(_correct_count, op=dist.ReduceOp.SUM)
dist.all_reduce(_total_count, op=dist.ReduceOp.SUM)
self.correct_count = _correct_count.item()
self.total_count = _total_count.item()
def get_metric(self, reset: bool = False):
// Returns
After Change
if is_distributed():
dist.all_reduce(correct_count_diff, op=dist.ReduceOp.SUM)
dist.all_reduce(total_count_diff, op=dist.ReduceOp.SUM)
self.correct_count += correct_count_diff.item()
self.total_count += total_count_diff.item()
else:
self.correct_count += correct_count_diff
self.total_count += total_count_diff
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 18
Instances
Project Name: allenai/allennlp
Commit Name: 0a456a7582da2ab4271756d7775bba84a75c8c0d
Time: 2020-08-17
Author: eladsegal@users.noreply.github.com
File Name: allennlp/training/metrics/categorical_accuracy.py
Class Name: CategoricalAccuracy
Method Name: __call__
Project Name: allenai/allennlp
Commit Name: 0a456a7582da2ab4271756d7775bba84a75c8c0d
Time: 2020-08-17
Author: eladsegal@users.noreply.github.com
File Name: allennlp/training/metrics/categorical_accuracy.py
Class Name: CategoricalAccuracy
Method Name: __call__
Project Name: allenai/allennlp
Commit Name: 87a61ad92a9e0129e5c81c242f0ea96d77e6b0af
Time: 2020-08-19
Author: akshita23bhagia@gmail.com
File Name: allennlp/training/metrics/attachment_scores.py
Class Name: AttachmentScores
Method Name: __call__
Project Name: allenai/allennlp
Commit Name: 0a456a7582da2ab4271756d7775bba84a75c8c0d
Time: 2020-08-17
Author: eladsegal@users.noreply.github.com
File Name: allennlp/training/metrics/boolean_accuracy.py
Class Name: BooleanAccuracy
Method Name: __call__