TorchLiter

module torchliter.engine.buffers

Global Variables


class BufferBase

Buffer base class.

method BufferBase.__init__

__init__(*args, **kwargs)

method BufferBase.load_state_dict

load_state_dict(state_dict)

method BufferBase.reset

reset()

method BufferBase.state_dict

state_dict()

method BufferBase.update

update(x: Any)

class SequenceContainer

Sequence container Ingests new values and extends self.value

method SequenceContainer.__init__

__init__(*args, **kwargs)

method SequenceContainer.load_state_dict

load_state_dict(state_dict)

method SequenceContainer.reset

reset()

method SequenceContainer.state_dict

state_dict()

method SequenceContainer.update

update(sequence: Union[List, Tuple])

class ExponentialMovingAverage

Exponential Moving Average of a series of Tensors.

update rule: EMA[x[t]] := (1 - alpha) * EMA[x[t-1]] + alpha * x[t] diff: delta[x[t]] := x[t] - EMA[x[t-1]]

method ExponentialMovingAverage.__init__

__init__(alpha: float = 0.01, **kwargs: Any)

property ExponentialMovingAverage.std


method ExponentialMovingAverage.load_state_dict

load_state_dict(state_dict)

method ExponentialMovingAverage.reset

reset()

method ExponentialMovingAverage.state_dict

state_dict()

method ExponentialMovingAverage.update

update(x)

class ScalarSummaryStatistics

Store the scalars and compute statistics.

The streaming scalars are stored in a list of any length. This is supposed to use in evals where the length is eval datasets.

Available statistics: - mean - median - std - max - min

method ScalarSummaryStatistics.__init__

__init__(**kwargs)

property ScalarSummaryStatistics.max


property ScalarSummaryStatistics.mean


property ScalarSummaryStatistics.median


property ScalarSummaryStatistics.min


property ScalarSummaryStatistics.std


method ScalarSummaryStatistics.load_state_dict

load_state_dict(state_dict)

method ScalarSummaryStatistics.reset

reset()

method ScalarSummaryStatistics.state_dict

state_dict()

method ScalarSummaryStatistics.update

update(x: float)

class ScalarSmoother

Rolling average of a stream of scalars.

The streaming scalars are stored in a deque of certain length (maxlen). The statistics are computed within the current deque.

Available statistics: - mean - median - std - max - min

method ScalarSmoother.__init__

__init__(window_size: int, **kwargs)

property ScalarSmoother.max


property ScalarSmoother.mean


property ScalarSmoother.median


property ScalarSmoother.min


property ScalarSmoother.std


method ScalarSmoother.load_state_dict

load_state_dict(state_dict)

method ScalarSmoother.reset

reset()

method ScalarSmoother.state_dict

state_dict()

method ScalarSmoother.update

update(x: float)

class VectorSmoother

Exponential moving average of n-dim vector:

vector = alpha * new_vector + (1 - alpha) * vector

Additional features: l_p normalization

method VectorSmoother.__init__

__init__(
    alpha: float,
    n_dim: int,
    init_value: float,
    eps: float = 1e-08,
    normalize: bool = True,
    p: float = 1.0,
    device: str = 'cpu',
    dtype: torch.dtype = torch.float32,
    **kwargs
)

property VectorSmoother.l1_norm


property VectorSmoother.l1_normalized


property VectorSmoother.l2_norm


property VectorSmoother.l2_normalized


property VectorSmoother.std


property VectorSmoother.vector


method VectorSmoother.load_state_dict

load_state_dict(state_dict)

method VectorSmoother.lp_norm

lp_norm(p: float)

method VectorSmoother.lp_normalized

lp_normalized(p: float)

method VectorSmoother.reset

reset()

method VectorSmoother.state_dict

state_dict()

method VectorSmoother.update

update(x: torch.Tensor)