emmi.utils.running_moments

Classes

RunningMoments

Calculates running moments of data (mean and variance) for data normalization purposes.

Module Contents

class emmi.utils.running_moments.RunningMoments

Calculates running moments of data (mean and variance) for data normalization purposes.

push_tensor(x, dim=1)

Add a tensor to the moment calculation. Calculations are carried out in float64 to avoid numerical imprecisions. :param x: Tensor to push. Shape should be (num_points, dim). The statistics are averaged over the num_points :param dim: Which dim (i.e., axis) contains the feature dimension. For example, in a pointcloud dim=1 calculates

the mean/std of the x, y and z positions. In an RGB image (batch_size, num_channels, height, width), dim=1 calculates the per-channel mean/std.

Parameters:

x (torch.Tensor)

Return type:

None

push_scalar(x)

Add a scalar to the moment calculation. Calculations are carried out in float64 to avoid numerical imprecisions. :param x: Scalar to add to the moment calculations.

Parameters:

x (float)

Return type:

None

mean()
Return type:

float

var()
Return type:

float

std()
Return type:

float