tff.structure.from_container
Stay organized with collections
Save and categorize content based on your preferences.
Creates an instance of Struct
from a Python container.
tff.structure.from_container(
value: object, recursive=False
) -> tff.structure.Struct
By default, this conversion is only performed at the top level for Python
dictionaries, collections.OrderedDict
s, namedtuple
s, list
s,
tuple
s, and attr.s
classes. Elements of these structures are not
recursively converted.
Args |
value
|
_The Python container to convert.
|
recursive
|
Whether to convert elements recursively (False by default).
|
Returns |
The corresponding instance of Struct .
|
Raises |
TypeError
|
If the value is not of one of the supported container types.
|
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.structure.from_container\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 an instance of `Struct` from a Python container. \n\n tff.structure.from_container(\n value: object, recursive=False\n ) -\u003e ../../tff/structure/Struct\n\nBy default, this conversion is only performed at the top level for Python\ndictionaries, `collections.OrderedDict`s, `namedtuple`s, `list`s,\n`tuple`s, and `attr.s` classes. Elements of these structures are not\nrecursively converted.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|-------------|---------------------------------------------------------------|\n| `value` | _The Python container to convert. |\n| `recursive` | Whether to convert elements recursively (`False` by default). |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ------- ||\n|---|---|\n| The corresponding instance of `Struct`. ||\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Raises ------ ||\n|-------------|----------------------------------------------------------------|\n| `TypeError` | If the `value` is not of one of the supported container types. |\n\n\u003cbr /\u003e"]]