View source on GitHub |
Standardized representation of server-to-client logic.
tff.backends.mapreduce.BroadcastForm(
compute_server_context,
client_processing,
server_data_label=None,
client_data_label=None
)
This class is designed to represent computations of the form:
server_data_type = self.compute_server_context.type_signature.parameter
client_data_type = self.client_processing.type_signature.parameter[1]
@tff.federated_computation(server_data_type, client_data_type)
def _(server_data, client_data):
# Select out the bit of server context to send to the clients.
context_at_server = tff.federated_map(
self.compute_server_context, server_data)
# Broadcast the context to the clients.
context_at_clients = tff.federated_broadcast(context_at_server)
# Compute some value on the clients based on the server context and
# the client data.
return tff.federated_map(
self.client_processing, (context_at_clients, client_data))
Attributes | |
---|---|
client_data_label
|
|
client_processing
|
|
compute_server_context
|
|
server_data_label
|
Methods
summary
summary(
print_fn=print
)
Prints a string summary of the BroadcastForm
.
Args | |
---|---|
print_fn
|
Print function to use. It will be called on each line of the summary in order to capture the string summary. |