tft.MeanAndVarCombiner

Class MeanAndVarCombiner

Combines a PCollection of accumulators to compute mean and variance.

__init__

__init__(
    output_numpy_dtype,
    output_shape=None
)

Properties

accumulator_coder

Methods

add_input

add_input(
    accumulator,
    batch_values
)

Composes an accumulator from batch_values and calls merge_accumulators.

Args:

  • accumulator: The _MeanAndVarAccumulator computed so far.
  • batch_values: A _MeanAndVarAccumulator for the current batch.

Returns:

A _MeanAndVarAccumulator which is accumulator and batch_values combined.

create_accumulator

create_accumulator()

Create an accumulator with all zero entries.

extract_output

extract_output(accumulator)

Converts an accumulator into the output (mean, var) tuple.

Args:

  • accumulator: the final _MeanAndVarAccumulator value.

Returns:

A 2-tuple composed of (mean, var) or None if accumulator is None.

merge_accumulators

merge_accumulators(accumulators)

Merges several _MeanAndVarAccumulators to a single accumulator.

Args:

  • accumulators: A list of _MeanAndVarAccumulators and/or Nones.

Returns:

The sole merged _MeanAndVarAccumulator.

output_tensor_infos

output_tensor_infos()