Missed TensorFlow World? Check out the recap. Learn more

tff.utils.build_encoded_mean

View source on GitHub

Builds StatefulAggregateFn for values, to be encoded by encoders.

tff.utils.build_encoded_mean(
    values,
    encoders
)

Args:

  • values: Values to be encoded by the StatefulAggregateFn. Must be convertible to tff.Value.
  • encoders: A collection of GatherEncoder objects to be used for encoding values. Must have the same structure as values.

Returns:

A StatefulAggregateFn of which next_fn encodes the input at tff.CLIENTS, and computes their mean at tff.SERVER, automatically splitting the decoding part based on its commutativity with sum.

Raises:

  • ValueError: If values and encoders do not have the same structure.
  • TypeError: If encoders are not instances of GatherEncoder, or if values are not compatible with the expected input of the encoders.