tff.templates.chain_measured_processes
Stay organized with collections
Save and categorize content based on your preferences.
Creates a composition of multiple tff.templates.MeasuredProcess
es.
tff.templates.chain_measured_processes(
measured_processes: collections.OrderedDict[str, MeasuredProcess]
) -> tff.templates.MeasuredProcess
Composing MeasuredProcess
es is a chaining process in which the output of the
first MeasuredProcess
feeds the input of the following MeasuredProcess
.
For example, given y = f(x)
and z = g(y)
, this produces a new z = h(x)
such that h(x) = g(f(x))
.
Guidance for Composition
Two MeasuredProcess
es F(x) and G(y) can be composed into a new
MeasuredProcess
called C with the following properties:
C.state
is the concatenation <F=F.state, G=G.state>
as an
OrderedDict
.
C.next(C.state, x).result ==
G.next(G.state, F.next(F.state, x).result).result
C.measurements
is the concatenation
<F=F.measurements, G=G.measurements>
as an OrderedDict
.
The resulting composition C would have the following type signatures:
initialize: ( -> <F=F.initialize, G=G.initialize>)
next: (<<F=F.state, G=G.state>, F.input> -> <state=<F=F.state, G=G.State>,
result=G.result, measurements=<F=F.measurements, G=G.measurements>)
Note that the guidance for composition is not strict and details are allowed
to differ.
Args |
measured_processes
|
An OrderedDict of MeasuredProcess es with keys as the
process name and values as the corresponding MeasuredProcess .
|
Returns |
A MeasuredProcess of the composition of input MeasuredProcess es.
|
Raises |
TypeError
|
If the MeasuredProcess es have the state at different placement
(e.g. F.state@SERVER, G.state@CLIENTS).
|
TypeError
|
If the function argment type doesn't match with the input type of
the composite function.
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-09-20 UTC.
[null,null,["Last updated 2024-09-20 UTC."],[],[],null,["# tff.templates.chain_measured_processes\n\n\u003cbr /\u003e\n\n|-------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/tensorflow/federated/blob/v0.87.0 Version 2.0, January 2004 Licensed under the Apache License, Version 2.0 (the) |\n\nCreates a composition of multiple [`tff.templates.MeasuredProcess`](../../tff/templates/MeasuredProcess)es. \n\n tff.templates.chain_measured_processes(\n measured_processes: collections.OrderedDict[str, MeasuredProcess]\n ) -\u003e ../../tff/templates/MeasuredProcess\n\nComposing `MeasuredProcess`es is a chaining process in which the output of the\nfirst `MeasuredProcess` feeds the input of the following `MeasuredProcess`.\nFor example, given `y = f(x)` and `z = g(y)`, this produces a new `z = h(x)`\nsuch that `h(x) = g(f(x))`.\n\n*Guidance for Composition*\nTwo `MeasuredProcess`es *F(x)* and *G(y)* can be composed into a new\n`MeasuredProcess` called *C* with the following properties:\n\n- `C.state` is the concatenation `\u003cF=F.state, G=G.state\u003e` as an `OrderedDict`.\n- `C.next(C.state, x).result ==\n G.next(G.state, F.next(F.state, x).result).result`\n- `C.measurements` is the concatenation `\u003cF=F.measurements, G=G.measurements\u003e` as an `OrderedDict`.\n\nThe resulting composition *C* would have the following type signatures:\ninitialize: `( -\u003e \u003cF=F.initialize, G=G.initialize\u003e)`\nnext: `(\u003c\u003cF=F.state, G=G.state\u003e, F.input\u003e -\u003e \u003cstate=\u003cF=F.state, G=G.State\u003e,\nresult=G.result, measurements=\u003cF=F.measurements, G=G.measurements\u003e)`\n\nNote that the guidance for composition is not strict and details are allowed\nto differ.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|----------------------|--------------------------------------------------------------------------------------------------------------------------|\n| `measured_processes` | An `OrderedDict` of `MeasuredProcess`es with keys as the process name and values as the corresponding `MeasuredProcess`. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ------- ||\n|---|---|\n| A `MeasuredProcess` of the composition of input `MeasuredProcess`es. ||\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Raises ------ ||\n|-------------|----------------------------------------------------------------------------------------------------------|\n| `TypeError` | If the `MeasuredProcess`es have the state at different placement (e.g. F.state@SERVER, G.state@CLIENTS). |\n| `TypeError` | If the function argment type doesn't match with the input type of the composite function. |\n\n\u003cbr /\u003e"]]