Example #1
0
 def foo(x):
     plus = computations.tf_computation(tf.add)
     val = intrinsics.federated_reduce(x, 0, plus)
     self.assertIsInstance(val, value_base.Value)
     return val
 def foo(x):
     plus = computations.tf_computation(lambda a, b: tf.add(a, b))  # pylint: disable=unnecessary-lambda
     val = intrinsics.federated_reduce(x, 0, plus)
     self.assertIsInstance(val, value_base.Value)
     return val
 def bar(x):
   return intrinsics.federated_reduce(x, 0, foo)
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_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 comp():
     return intrinsics.federated_reduce(
         intrinsics.federated_value(10, placements.CLIENTS), 0,
         add_numbers)
Example #7
0
 def foo(x):
     plus = computations.tf_computation(tf.add, [tf.int32, tf.int32])
     return intrinsics.federated_reduce(x, 0, plus)
Example #8
0
 def foo(x):
     return intrinsics.federated_reduce(x, 0., add)