ksuit.utils.training.running_stats

Classes

RunningStats

Calculates statistics of data (min, max, mean and variance) for data normalization purposes.

Module Contents

class ksuit.utils.training.running_stats.RunningStats(name=None)

Calculates statistics of data (min, max, mean and variance) for data normalization purposes.

Parameters:

name (str | None)

name = None
push_tensor(x, dim=1)

Add a tensor to the statistics. Calculations are carried out in float64 to avoid numerical imprecision. :param x: Tensor with data. :param dim: Which dim (i.e., axis) contains the feature dimension. For example, in a point cloud with shape

(num_points, 3) dim=1 calculates the stats of the x, y and z positions. In an RGB image with shape (batch_size, num_channels, height, width), dim=1 calculates the per-channel statistics.

Parameters:
  • x (torch.Tensor)

  • dim (int)

Return type:

None

property min: torch.Tensor
Return type:

torch.Tensor

property max: torch.Tensor
Return type:

torch.Tensor

property mean: torch.Tensor
Return type:

torch.Tensor

property var: torch.Tensor
Return type:

torch.Tensor

property std: torch.Tensor
Return type:

torch.Tensor

property logmean: torch.Tensor
Return type:

torch.Tensor

property logvar: torch.Tensor
Return type:

torch.Tensor

property logstd: torch.Tensor
Return type:

torch.Tensor