tff.aggregators.concat_factory
Stay organized with collections
Save and categorize content based on your preferences.
Aggregation factory for concatenation of input to a single tensor.
tff.aggregators.concat_factory(
inner_agg_factory: _T
) -> _T
The created tff.templates.AggregationProcess
takes the input structure,
reshapes each tensor in the structure to a rank-1 tensor, and concatenates
them into a single tensor, which is passed to the inner aggregation. After the
inner aggregation, the concatenated tensor is split and packed into the
original structure.
For example, if this factory receives TFF type <float32[N],float32[P,Q]>
,
then the inner_agg_factory
will operate on <float32[N + P * Q]>
. Note that
the factory expects all tensors in the structure to have the same numeric
dtype; for example, an input value_type
of <int32[N],float32[P,Q]>
or
<string[N]>
will raise an error.
This aggregator may be useful as a preprocessing step for algorithms that need
to operate on client values as a single vector; for example, the algorithm may
need to apply randomized Hadamard transform with zero padding on the client
vectors, in which case applying the transform separately on each component
may not be identical to applying the transform to the single vector at once.
The returned factory takes its weightedness
(UnweightedAggregationFactory
vs. WeightedAggregationFactory
) from the
inner_agg_factory
.
This factory only accepts value_type
of either tff.TensorType
or
tff.StructWithPythonType
and expects the dtype of component tensors to be
either all real integers or all real floats.
Args |
inner_agg_factory
|
A factory specifying the type of aggregation to be done
after flattening and concatenating the structure into a single vector.
|
Returns |
An aggregation factory that flattens and concatenates the components of a
tensor structure into a single rank-1 tensor.
|
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.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-09-20 UTC."],[],[],null,["# tff.aggregators.concat_factory\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\nAggregation factory for concatenation of input to a single tensor. \n\n tff.aggregators.concat_factory(\n inner_agg_factory: _T\n ) -\u003e _T\n\nThe created [`tff.templates.AggregationProcess`](../../tff/templates/AggregationProcess) takes the input structure,\nreshapes each tensor in the structure to a rank-1 tensor, and concatenates\nthem into a single tensor, which is passed to the inner aggregation. After the\ninner aggregation, the concatenated tensor is split and packed into the\noriginal structure.\n\nFor example, if this factory receives TFF type `\u003cfloat32[N],float32[P,Q]\u003e`,\nthen the `inner_agg_factory` will operate on `\u003cfloat32[N + P * Q]\u003e`. Note that\nthe factory expects all tensors in the structure to have the same numeric\ndtype; for example, an input `value_type` of `\u003cint32[N],float32[P,Q]\u003e` or\n`\u003cstring[N]\u003e` will raise an error.\n\nThis aggregator may be useful as a preprocessing step for algorithms that need\nto operate on client values as a single vector; for example, the algorithm may\nneed to apply randomized Hadamard transform with zero padding on the client\nvectors, in which case applying the transform separately on each component\nmay not be identical to applying the transform to the single vector at once.\n\nThe returned factory takes its weightedness\n(`UnweightedAggregationFactory` vs. `WeightedAggregationFactory`) from the\n`inner_agg_factory`.\n\nThis factory only accepts `value_type` of either [`tff.TensorType`](../../tff/types/TensorType) or\n[`tff.StructWithPythonType`](../../tff/types/StructWithPythonType) and expects the dtype of component tensors to be\neither all real integers or all real floats.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|---------------------|--------------------------------------------------------------------------------------------------------------------------------|\n| `inner_agg_factory` | A factory specifying the type of aggregation to be done after flattening and concatenating the structure into a single vector. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ------- ||\n|---|---|\n| An aggregation factory that flattens and concatenates the components of a tensor structure into a single rank-1 tensor. ||\n\n\u003cbr /\u003e"]]