A conditional accumulator for aggregating gradients.

Inherits From: ConditionalAccumulatorBase

Up-to-date gradients (i.e., time step at which gradient was computed is equal to the accumulator's time step) are added to the accumulator.

Extraction of the average gradient is blocked until the required number of gradients has been accumulated.

dtype Datatype of the accumulated gradients.
shape Shape of the accumulated gradients.
shared_name Optional. If non-empty, this accumulator will be shared under the given name across multiple sessions.
name Optional name for the accumulator.
reduction_type Reduction type to use when taking the gradient.

accumulator_ref The underlying accumulator reference.
dtype The datatype of the gradients accumulated by this accumulator.
name The name of the underlying accumulator.



View source

Attempts to apply a gradient to the accumulator.

The attempt is silently dropped if the gradient is stale, i.e., local_step is less than the accumulator's global time step.

grad The gradient tensor to be applied.
local_step Time step at which the gradient was computed.
name Optional name for the operation.

The operation that (conditionally) applies a gradient to the accumulator.

ValueError If grad is of the wrong shape