tff.learning.metrics.create_default_secure_sum_quantization_ranges

Create a nested structure of quantization ranges for secure sum encoding.

local_unfinalized_metrics_type The tff.Type structure to generate default secure sum quantization ranges form. Must be a tff.Type tree containing only tff.TensorType and tff.StructType. Each tff.TensorType must be of floating point or integer dtype.
lower_bound An optional integer or floating point lower bound for the secure sum quantization range. Values smaller than this will be clipped to this value. By default is 0. If a float, any tff.TensorType in local_unfinalized_metrics_type with an integer dtype will use math.ceil(lower_bound) as a bound.
upper_bound An optional integer or floating point upper bound for the secure sum quantization range. Values larger than this will be clipped to this value. By default is 2^20 - 1 (~1 million). If a float, any tff.TensorType in local_unfinalized_metrics_type with an integer dtype will use math.floor(lower_bound) as a bound.
use_auto_tuned_bounds_for_float_values An optional boolean for specifying whether to use auto-tuned bounds for float values. If True, a default tff.templates.EstimationProcess is used for upper_bound, and the lower_bound is None to allow tff.aggregators.SecureSumFactory to determine the lower_bound.

A nested structure matching the structure of local_unfinalized_metrics_type where each tf.TensorType has been replaced with a 2-tuple of lower bound and upper bound, where the tuple can be (float, float) or (None, tff.templates.EstimationProcess) for floating dtypes, and (int, int) for integer dtypes.

UnquantizableDTypeError If A tff.TensorType in local_unfinalized_metrics_type has a non-float or non-integer dtype.
ValueError If an integer dtype in local_unfinalized_metrics_type will have a zero range (e.g. math.ceil(lower_bound) - math.floor(upper_bound) < 1).