Пример #1
0
 def next_computation(arg):
     """The logic of a single MapReduce sprocessing round."""
     s1 = arg[0]
     c1 = arg[1]
     s2 = tff.federated_apply(cf.prepare, s1)
     c2 = tff.federated_broadcast(s2)
     c3 = tff.federated_zip([c1, c2])
     c4 = tff.federated_map(cf.work, c3)
     c5 = c4[0]
     c6 = c4[1]
     s3 = tff.federated_aggregate(c5, cf.zero(), cf.accumulate, cf.merge,
                                  cf.report)
     s4 = tff.federated_zip([s1, s3])
     s5 = tff.federated_apply(cf.update, s4)
     s6 = s5[0]
     s7 = s5[1]
     return s6, s7, c6
Пример #2
0
 def select_random_multiples(x):
     random_tuples = tff.federated_map(generate_tuple, x)
     reversed_tuples = tff.federated_zip([
         tff.federated_map(select_second_index_tff, random_tuples),
         tff.federated_map(select_second_index_tff, random_tuples),
         tff.federated_map(select_second_index_tff, random_tuples)
     ])
     return reversed_tuples
Пример #3
0
 def baz(x):
   return tff.federated_zip(x)
Пример #4
0
 def foo(x):
   arg = {str(k): x[k] for k in range(n)}
   return tff.federated_zip(arg)
Пример #5
0
 def bar(x):
   arg = anonymous_tuple.AnonymousTuple([
       (str(k), x[k]) if k % 2 == 0 else (None, x[k]) for k in range(n)
   ])
   return tff.federated_zip(arg)
Пример #6
0
 def foo(arg):
   return tff.federated_zip(arg)
Пример #7
0
 def foo(x):
   return tff.federated_zip(x)
Пример #8
0
 def foo(x, y):
   return tff.federated_zip([x, y])
Пример #9
0
 def foo(arg):
   a = {'x': arg[0], 'y': arg[1]}
   return tff.federated_zip(a)
Пример #10
0
 def foo(x, y):
   a = {'x': x, 'y': y}
   return tff.federated_zip(a)
Пример #11
0
 def _(arg):
   return tff.federated_zip(arg)
Пример #12
0
 def bar(x):
     arg = anonymous_tuple.AnonymousTuple(
         _make_test_tuple(x, k) for k in range(n))
     return tff.federated_zip(arg)