View source on GitHub |
Computes a sum at tff.SERVER
of a value
placed on the tff.CLIENTS
.
tff.federated_secure_sum(
value, max_input
)
This function computes a sum such that it should not be possible for the server to learn any clients individual value. The specific algorithm and mechanism used to compute the secure sum may vary depending on the target runtime environment the computation is compiled for or executed on. See https://research.google/pubs/pub47246/ for more information.
Not all executors support tff.federated_secure_sum()
; consult the
documentation for the specific executor or executor stack you plan on using
for the specific of how it's handled by that executor.
The max_input
argument is the maximum value (inclusive) that may appear in
value
. Lower values may allow for improved communication efficiency.
Attempting to return a value
higher than max_input
is invalid, and will
result in a failure at the given client.
Example:
value = tff.federated_value(1, tff.CLIENTS)
result = tff.federated_secure_sum(value, 1)
value = tff.federated_value((1, 2), tff.CLIENTS)
result = tff.federated_secure_sum(value, (1, 2))
Args | |
---|---|
value
|
An integer or nested structure of integers placed at tff.CLIENTS ,
in the range [0, max_input] .
|
max_input
|
A Python integer or nested structure of integers matching the
structure of value . If integer max_value is used with a nested
value , the same integer is used for each tensor in value .
|
Returns | |
---|---|
A representation of the sum of the member constituents of value placed
on the tff.SERVER .
|
Raises | |
---|---|
TypeError
|
If the argument is not a federated TFF value placed at
tff.CLIENTS .
|