# tff.structure.from_container

<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) 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) |

Creates an instance of `Struct` from a Python container.

    tff.structure.from_container(
        value: object, recursive=False
    ) -> https://www.tensorflow.org/federated/api_docs/python/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.

<br />

<br />

<br />

| ## Args ||
|---|---|
| `value` | _The Python container to convert. |
| `recursive` | Whether to convert elements recursively (`False` by default). |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| The corresponding instance of `Struct`. ||

<br />

<br />

<br />

<br />

| ## Raises ||
|---|---|
| `TypeError` | If the `value` is not of one of the supported container types. |

<br />