tf.compat.v1.ConditionalAccumulatorBase

A conditional accumulator for aggregating gradients.

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.

dtypeDatatype of the accumulated gradients.
shapeShape of the accumulated gradients.
accumulator_refA handle to the conditional accumulator, created by sub- classes

accumulator_refThe underlying accumulator reference.
dtypeThe datatype of the gradients accumulated by this accumulator.
nameThe name of the underlying accumulator.

Methods

num_accumulated

View source

Number of gradients that have currently been aggregated in accumulator.

Args
nameOptional name for the operation.

Returns
Number of accumulated gradients currently in accumulator.

set_global_step

View source

Sets the global time step of the accumulator.

The operation logs a warning if we attempt to set to a time step that is lower than the accumulator's own time step.

Args
new_global_stepValue of new time step. Can be a variable or a constant
nameOptional name for the operation.

Returns
Operation that sets the accumulator's time step.