@tf.function def exceeds_threshold_fn(reading,threshold):#on-device processing return tf.to_float(reading > threshold) @tff.federated_computation def get_fraction_over_threshold(readings, threshold): return tff.federated_mean( #collective operations tff.federated_map( #collective communication tff.tf_computation(exceeds_threshold_fn), [readings, tff.federated_broadcast(threshold)]))