pytorch-encoding/encoding/nn/syncbn.py
def _compute_mean_std(self, sum_, ssum, size):
        """Compute the mean and standard-deviation with sum and square-sum. This method
        also maintains the moving average on the master device."""
        assert size > 1, 'BatchNorm computes unbiased standard-deviation, which requires size > 1.'
        mean = sum_ / size
        sumvar = ssum - sum_ * mean
        unbias_var = sumvar / (size - 1)
        bias_var = sumvar / size

        self.running_mean = (1 - self.momentum) * self.running_mean + self.momentum * mean.data
        self.running_var = (1 - self.momentum) * self.running_var + self.momentum * unbias_var.data

        return mean, (bias_var + self.eps) ** -0.5
Compute the mean and standard-deviation with sum and square-sum. This method
        also maintains the moving average on the master device.
Compute the mean and standard-deviation with sum and square-sum. This method
also maintains the moving average on the master device.
Compute the mean and standard - deviation with sum and square - sum . This method also maintains the moving average on the master device .
def _compute_mean_std(self, sum_, ssum, size):
        assert size > 1, 'BatchNorm computes unbiased standard-deviation, which requires size > 1.'
        mean = sum_ / size
        sumvar = ssum - sum_ * mean
        unbias_var = sumvar / (size - 1)
        bias_var = sumvar / size
        self.running_mean = (1 - self.momentum) * self.running_mean + self.momentum * mean.data
        self.running_var = (1 - self.momentum) * self.running_var + self.momentum * unbias_var.data
        return mean, (bias_var + self.eps) ** -0.5
def _compute_mean_std ( self , sum_ , ssum , size ) : assert size > 1 , 'BatchNorm computes unbiased standard-deviation, which requires size > 1.' mean = sum_ / size sumvar = ssum - sum_ * mean unbias_var = sumvar / ( size - 1 ) bias_var = sumvar / size self . running_mean = ( 1 - self . momentum ) * self . running_mean + self . momentum * mean . data self . running_var = ( 1 - self . momentum ) * self . running_var + self . momentum * unbias_var . data return mean , ( bias_var + self . eps ) ** - 0.5
Compute the mean and standard-deviation with sum and square-sum.
Compute the mean and standard - deviation with sum and square - sum .
"""Compute the mean and standard-deviation with sum and square-sum. This method
        also maintains the moving average on the master device."""
self
sum_
ssum
size