Constructs a new structure with new values for fields in kwargs.
tff.structure.update_struct(structure,**kwargs)
This is a helper method for working structured objects in a functional manner.
This method will create a new structure where the fields named by keys in
kwargs replaced with the associated values.
Args
structure
_The structure with named fields to update.
**kwargs
_The list of key-value pairs of fields to update in structure.
Returns
A new instance of the same type of structure, with the fields named
in the keys of **kwargs replaced with the associated values.
Raises
KeyError
If kwargs contains a field that is not in structure.
TypeError
If structure is not a structure with named fields.
[null,null,["Last updated 2024-09-20 UTC."],[],[],null,["# tff.structure.update_struct\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\nConstructs a new `structure` with new values for fields in `kwargs`. \n\n tff.structure.update_struct(\n structure, **kwargs\n )\n\nThis is a helper method for working structured objects in a functional manner.\nThis method will create a new structure where the fields named by keys in\n`kwargs` replaced with the associated values.\n| **Note:** _This method only works on the first level of `structure`, and does not recurse in the case of nested structures. A field that is itself a structure can be replaced with another structure.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|-------------|------------------------------------------------------------------|\n| `structure` | _The structure with named fields to update. |\n| `**kwargs` | _The list of key-value pairs of fields to update in `structure`. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ------- ||\n|---|---|\n| A new instance of the same type of `structure`, with the fields named in the keys of `**kwargs` replaced with the associated values. ||\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Raises ------ ||\n|-------------|------------------------------------------------------|\n| `KeyError` | If kwargs contains a field that is not in structure. |\n| `TypeError` | If structure is not a structure with named fields. |\n\n\u003cbr /\u003e"]]