def comp(): x = intrinsics.federated_value(10, placement_literals.CLIENTS) return intrinsics.federated_collect(x)
def comp(): return intrinsics.federated_value(10, placement_literals.SERVER)
def unsecure_aggregation(): data_at_clients = intrinsics.federated_value(1, placements.CLIENTS) return intrinsics.federated_sum(data_at_clients)
def comp(): value = intrinsics.federated_value(10, placement_literals.CLIENTS) return intrinsics.federated_map(add_one, value)
def comp(): return intrinsics.federated_zip([ intrinsics.federated_value(10, placement_literals.CLIENTS), intrinsics.federated_value(20, placement_literals.CLIENTS), ])
def federated_aggregate_test(args, weights): state = intrinsics.federated_value(aggregate_fn.initialize(), placements.SERVER) return aggregate_fn(state, args, weights)
def call_secure_sum(value): # pylint: disable=unused-variable lower_bound = intrinsics.federated_value(0, placements.CLIENTS) upper_bound = intrinsics.federated_value(1, placements.CLIENTS) summed_value = federated_aggregations.secure_quantized_sum( value, lower_bound, upper_bound) return summed_value
def comp(unknown_func): return unknown_func( intrinsics.federated_value(1, placement_literals.CLIENTS))
def simple_reduce(): one_at_clients = intrinsics.federated_value(1, placement_literals.CLIENTS) zero = 0 op = computations.tf_computation(lambda a, b: a + b) return intrinsics.federated_reduce(one_at_clients, zero, op)
def trivial_sum(): empty_at_clients = intrinsics.federated_value((), placement_literals.CLIENTS) return intrinsics.federated_sum(empty_at_clients)
def trivial_secure_sum(): empty_at_clients = intrinsics.federated_value((), placement_literals.CLIENTS) bitwidth = () return intrinsics.federated_secure_sum(empty_at_clients, bitwidth)
def trivial_reduce(): empty_at_clients = intrinsics.federated_value((), placement_literals.CLIENTS) zero = () op = computations.tf_computation(lambda _a, _b: ()) return intrinsics.federated_reduce(empty_at_clients, zero, op)
def non_aggregation_intrinsics(): return intrinsics.federated_broadcast( intrinsics.federated_value(5, placement_literals.SERVER))
def bar(): x = intrinsics.federated_value(make_dataset(), placement_literals.CLIENTS) return intrinsics.federated_map( foo, intrinsics.federated_collect(intrinsics.federated_map(foo, x)))
def init_computation(): return intrinsics.federated_value(cf.initialize(), placements.SERVER)
def simple_sum(): one_at_clients = intrinsics.federated_value(1, placement_literals.CLIENTS) return intrinsics.federated_sum(one_at_clients)
def federated_broadcast_test(args): state = intrinsics.federated_value(broadcast_fn.initialize(), placements.SERVER) return broadcast_fn(state, args)
def simple_weighted_mean(): one_at_clients = intrinsics.federated_value(1.0, placement_literals.CLIENTS) return intrinsics.federated_mean(one_at_clients, weight=one_at_clients)
def run_initialize(): return intrinsics.federated_value(dp_aggregate_fn.initialize(), placement_literals.SERVER)
def simple_secure_sum(): one_at_clients = intrinsics.federated_value(1, placement_literals.CLIENTS) bitwidth = 1 return intrinsics.federated_secure_sum(one_at_clients, bitwidth)
def comp(): value_at_server = intrinsics.federated_value( 10, placement_literals.SERVER) value_at_clients = intrinsics.federated_broadcast(value_at_server) return intrinsics.federated_map(add_one, value_at_clients)
def comp(): ones_at_clients = intrinsics.federated_value( (1, 1), placement_literals.CLIENTS) bitwidth = (1, 1) return intrinsics.federated_secure_sum(ones_at_clients, bitwidth)
def comp(): value = intrinsics.federated_value(10, placement_literals.CLIENTS) return factory.federated_map_all_equal(add_one, value)
def next_fn(state, value): summed_value = intrinsics.federated_sum(value) empty_measurements = intrinsics.federated_value((), placements.SERVER) return measured_process.MeasuredProcessOutput( state, summed_value, empty_measurements)
def comp(): value = intrinsics.federated_value(10, placement_literals.CLIENTS) return intrinsics.federated_sum(value)
def init_fn(): return intrinsics.federated_value(False, placements.SERVER)
def secure_aggregation(): data_at_clients = intrinsics.federated_value(1, placements.CLIENTS) bitwidth = 1 return intrinsics.federated_secure_sum(data_at_clients, bitwidth)
def next_fn(server_val, client_val): del server_val # Unused result_on_clients = intrinsics.federated_map(map_fn, client_val) aggregated_result = intrinsics.federated_sum(result_on_clients) side_output = intrinsics.federated_value(False, placements.SERVER) return side_output, aggregated_result
def comp(): value = intrinsics.federated_value(10, placement_literals.CLIENTS) return intrinsics.federated_aggregate(value, 0, add_int, add_int, add_five)
def comp(): x = intrinsics.federated_value(10, placement_literals.CLIENTS) return intrinsics.federated_aggregate(x, 0, add_numbers, add_numbers, add_one_because_why_not)