Builds StatefulAggregateFn for values, to be encoded by encoders.

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.

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

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.