tff.learning.templates.FinalizerProcess
Stay organized with collections
Save and categorize content based on your preferences.
A stateful process for finalization of a round of training.
Inherits From: MeasuredProcess
, IterativeProcess
tff.learning.templates.FinalizerProcess(
initialize_fn: tff.Computation
,
next_fn: tff.Computation
,
*,
get_hparams_fn: Optional[tff.Computation
] = None,
set_hparams_fn: Optional[tff.Computation
] = None
)
A FinalizerProcess
is a tff.templates.MeasuredProcess
that formalizes the
type signature of initialize_fn
and next_fn
for the work performed by
server in a learning process after aggregating model updates from clients.
Args |
initialize_fn
|
A tff.Computation matching the criteria above.
|
next_fn
|
A tff.Computation matching the criteria above.
|
get_hparams_fn
|
An optional tff.Computation matching the criteria above.
If not provided, this defaults to a computation that returns an empty
ordred dictionary, regardless of the contents of the state.
|
set_hparams_fn
|
An optional tff.Computation matching the criteria above.
If not provided, this defaults to a pass-through computation, that
returns the input state regardless of the hparams passed in.
|
Raises |
TemplateNotFederatedError
|
If any of the federated computations provided
do not return a federated type.
|
TemplateNextFnNumArgsError
|
If the next_fn has an incorrect number
of arguments.
|
TemplatePlacementError
|
If any of the federated computations have an
incorrect placement.
|
FinalizerResultTypeError
|
If the second output of next_fn does not meet
the criteria outlined above.
|
GetHparamsTypeError
|
If the type signature of get_hparams_fn does not
meet the criteria above.
|
SetHparamsTypeError
|
If the type signature of set_hparams_fn does not
meet the criteria above.
|
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.learning.templates.FinalizerProcess\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\nA stateful process for finalization of a round of training.\n\nInherits From: [`MeasuredProcess`](../../../tff/templates/MeasuredProcess), [`IterativeProcess`](../../../tff/templates/IterativeProcess) \n\n tff.learning.templates.FinalizerProcess(\n initialize_fn: ../../../tff/Computation,\n next_fn: ../../../tff/Computation,\n *,\n get_hparams_fn: Optional[../../../tff/Computation] = None,\n set_hparams_fn: Optional[../../../tff/Computation] = None\n )\n\nA `FinalizerProcess` is a [`tff.templates.MeasuredProcess`](../../../tff/templates/MeasuredProcess) that formalizes the\ntype signature of `initialize_fn` and `next_fn` for the work performed by\nserver in a learning process after aggregating model updates from clients.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `initialize_fn` | A [`tff.Computation`](../../../tff/Computation) matching the criteria above. |\n| `next_fn` | A [`tff.Computation`](../../../tff/Computation) matching the criteria above. |\n| `get_hparams_fn` | An optional [`tff.Computation`](../../../tff/Computation) matching the criteria above. If not provided, this defaults to a computation that returns an empty ordred dictionary, regardless of the contents of the state. |\n| `set_hparams_fn` | An optional [`tff.Computation`](../../../tff/Computation) matching the criteria above. If not provided, this defaults to a pass-through computation, that returns the input state regardless of the hparams passed in. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Raises ------ ||\n|------------------------------|-------------------------------------------------------------------------------|\n| `TemplateNotFederatedError` | If any of the federated computations provided do not return a federated type. |\n| `TemplateNextFnNumArgsError` | If the `next_fn` has an incorrect number of arguments. |\n| `TemplatePlacementError` | If any of the federated computations have an incorrect placement. |\n| `FinalizerResultTypeError` | If the second output of `next_fn` does not meet the criteria outlined above. |\n| `GetHparamsTypeError` | If the type signature of `get_hparams_fn` does not meet the criteria above. |\n| `SetHparamsTypeError` | If the type signature of `set_hparams_fn` does not meet the criteria above. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Attributes ---------- ||\n|---------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `get_hparams` | \u003cbr /\u003e \u003cbr /\u003e |\n| `initialize` | A no-arg [`tff.Computation`](../../../tff/Computation) that returns the initial state. |\n| `next` | A [`tff.Computation`](../../../tff/Computation) that produces the next state. \u003cbr /\u003e Its first argument should always be the current state (originally produced by [`tff.templates.IterativeProcess.initialize`](../../../tff/templates/IterativeProcess#initialize)), and the first (or only) returned value is the updated state. |\n| `set_hparams` | \u003cbr /\u003e \u003cbr /\u003e |\n| `state_type` | The [`tff.Type`](../../../tff/types/Type) of the state of the process. |\n\n\u003cbr /\u003e"]]