mighty.utils.var_online.MeanOnlineBatch

class mighty.utils.var_online.MeanOnlineBatch(tensor=None)[source]

Online mean measure that updates 1d vector mean from a batch of vectors (2d tensor).

Methods

__init__([tensor])

activate(is_active)

Activates or deactivates the updates.

get_mean()

Returns:

reset()

Reset the mean and the count.

update(tensor)

Update sample mean (and variance) from a batch of new values.

activate(is_active)

Activates or deactivates the updates.

Parameters:
is_activebool

New state.

get_mean()
Returns:
torch.Tensor

The mean of all tensors.

reset()

Reset the mean and the count.

update(tensor)[source]

Update sample mean (and variance) from a batch of new values.

Parameters:
tensortorch.Tensor

Next tensor sample.