def comp():
     x = intrinsics.federated_value(10, placement_literals.CLIENTS)
     return intrinsics.federated_collect(x)
示例#2
0
 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)
示例#4
0
 def comp():
     value = intrinsics.federated_value(10, placement_literals.CLIENTS)
     return intrinsics.federated_map(add_one, value)
示例#5
0
 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)
示例#7
0
 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
示例#8
0
 def comp(unknown_func):
     return unknown_func(
         intrinsics.federated_value(1, placement_literals.CLIENTS))
示例#9
0
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)
示例#10
0
def trivial_sum():
    empty_at_clients = intrinsics.federated_value((),
                                                  placement_literals.CLIENTS)
    return intrinsics.federated_sum(empty_at_clients)
示例#11
0
def trivial_secure_sum():
    empty_at_clients = intrinsics.federated_value((),
                                                  placement_literals.CLIENTS)
    bitwidth = ()
    return intrinsics.federated_secure_sum(empty_at_clients, bitwidth)
示例#12
0
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)
示例#13
0
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)))
示例#15
0
 def init_computation():
     return intrinsics.federated_value(cf.initialize(), placements.SERVER)
示例#16
0
def simple_sum():
    one_at_clients = intrinsics.federated_value(1, placement_literals.CLIENTS)
    return intrinsics.federated_sum(one_at_clients)
示例#17
0
 def federated_broadcast_test(args):
     state = intrinsics.federated_value(broadcast_fn.initialize(),
                                        placements.SERVER)
     return broadcast_fn(state, args)
示例#18
0
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)
示例#19
0
 def run_initialize():
     return intrinsics.federated_value(dp_aggregate_fn.initialize(),
                                       placement_literals.SERVER)
示例#20
0
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)
示例#21
0
 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)
示例#22
0
 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)
示例#23
0
 def comp():
     value = intrinsics.federated_value(10, placement_literals.CLIENTS)
     return factory.federated_map_all_equal(add_one, value)
示例#24
0
 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)
示例#25
0
 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)