# Module: tff.structure

<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) |

Container for structures with named and/or unnamed fields.

## Classes

[`class Callable`](https://www.tensorflow.org/federated/api_docs/python/tff/structure/Callable)

[`class Iterable`](https://www.tensorflow.org/federated/api_docs/python/tff/structure/Iterable)

[`class Iterator`](https://www.tensorflow.org/federated/api_docs/python/tff/structure/Iterator)

[`class Mapping`](https://www.tensorflow.org/federated/api_docs/python/tff/structure/Mapping)

[`class Struct`](https://www.tensorflow.org/federated/api_docs/python/tff/structure/Struct): Represents a struct-like structure with named and/or unnamed fields.

## Functions

[`flatten(...)`](https://www.tensorflow.org/federated/api_docs/python/tff/structure/flatten): Returns a list of values in a possibly recursively nested `Struct`.

[`from_container(...)`](https://www.tensorflow.org/federated/api_docs/python/tff/structure/from_container): Creates an instance of `Struct` from a Python container.

[`has_field(...)`](https://www.tensorflow.org/federated/api_docs/python/tff/structure/has_field): Returns `True` if the `structure` has the `field`.

[`is_same_structure(...)`](https://www.tensorflow.org/federated/api_docs/python/tff/structure/is_same_structure): Compares whether `a` and `b` have the same nested structure.

[`iter_elements(...)`](https://www.tensorflow.org/federated/api_docs/python/tff/structure/iter_elements): Returns an iterator over (name, value) pairs from a `Struct`.

[`map_structure(...)`](https://www.tensorflow.org/federated/api_docs/python/tff/structure/map_structure): Applies `fn` to each entry in `structure` and returns a new structure.

[`name_list(...)`](https://www.tensorflow.org/federated/api_docs/python/tff/structure/name_list): Returns a `list` of the names of the named fields in `struct`.

[`name_list_with_nones(...)`](https://www.tensorflow.org/federated/api_docs/python/tff/structure/name_list_with_nones): Returns an iterator over the names of all fields in `struct`.

[`name_to_index_map(...)`](https://www.tensorflow.org/federated/api_docs/python/tff/structure/name_to_index_map): Returns map from names in `structure` to their indices.

[`pack_sequence_as(...)`](https://www.tensorflow.org/federated/api_docs/python/tff/structure/pack_sequence_as): Returns a list of values in a possibly recursively nested `Struct`.

[`to_elements(...)`](https://www.tensorflow.org/federated/api_docs/python/tff/structure/to_elements): Retrieves the list of (name, value) pairs from a `Struct`.

[`to_odict(...)`](https://www.tensorflow.org/federated/api_docs/python/tff/structure/to_odict): Returns `struct` as an `collections.OrderedDict`, if possible.

[`to_odict_or_tuple(...)`](https://www.tensorflow.org/federated/api_docs/python/tff/structure/to_odict_or_tuple): Returns `struct` as an `collections.OrderedDict` or `tuple`, if possible.

[`update_struct(...)`](https://www.tensorflow.org/federated/api_docs/python/tff/structure/update_struct): Constructs a new `structure` with new values for fields in `kwargs`.