ed322ebaf136955b8f9f060d8fc49a6c252a0bba,allennlp/training/metrics/average.py,Average,__call__,#Average#Any#,24

Before Change


        
        _total_value = list(self.detach_tensors(value))[0]
        _count = 1
        if is_distributed():
            device = torch.device("cuda" if dist.get_backend() == "nccl" else "cpu")
            count = torch.tensor(_count, device=device)
            total_value = torch.tensor(_total_value, device=device)
            dist.all_reduce(count, op=dist.ReduceOp.SUM)
            dist.all_reduce(total_value, op=dist.ReduceOp.SUM)
            _count = count.item()
            _total_value = total_value.item()
        self._count += _count
        self._total_value += _total_value

    @overrides

After Change


            The value to average.
        
        self._count += dist_reduce(1, ReduceOp.SUM)
        self._total_value += dist_reduce(float(list(self.detach_tensors(value))[0]), ReduceOp.SUM)

    @overrides
    def get_metric(self, reset: bool = False):
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 6

Instances


Project Name: allenai/allennlp
Commit Name: ed322ebaf136955b8f9f060d8fc49a6c252a0bba
Time: 2021-01-20
Author: epwalsh10@gmail.com
File Name: allennlp/training/metrics/average.py
Class Name: Average
Method Name: __call__


Project Name: tensorly/tensorly
Commit Name: 55ed12ebcce6cd71945fef8387767484c80abc2c
Time: 2021-03-04
Author: taylorpatti@g.harvard.edu
File Name: tensorly/metrics/entropy.py
Class Name:
Method Name: vonNeumann_entropy


Project Name: arraiy/torchgeometry
Commit Name: bd21bb4fec8d10b257ceccc3d302abd6d5b7c7d5
Time: 2020-08-26
Author: sj8716643@126.com
File Name: kornia/augmentation/random_generator.py
Class Name:
Method Name: random_sharpness_generator