Module: tff.structure

Container for structures with named and/or unnamed fields.

Classes

class Callable

class Iterable

class Iterator

class Mapping

class Struct: Represents a struct-like structure with named and/or unnamed fields.

Functions

flatten(...): Returns a list of values in a possibly recursively nested Struct.

from_container(...): Creates an instance of Struct from a Python container.

has_field(...): Returns True if the structure has the field.

is_same_structure(...): Compares whether a and b have the same nested structure.

iter_elements(...): Returns an iterator over (name, value) pairs from a Struct.

map_structure(...): Applies fn to each entry in structure and returns a new structure.

name_list(...): Returns a list of the names of the named fields in struct.

name_list_with_nones(...): Returns an iterator over the names of all fields in struct.

name_to_index_map(...): Returns map from names in structure to their indices.

pack_sequence_as(...): Returns a list of values in a possibly recursively nested Struct.

to_elements(...): Retrieves the list of (name, value) pairs from a Struct.

to_odict(...): Returns struct as an collections.OrderedDict, if possible.

to_odict_or_tuple(...): Returns struct as an collections.OrderedDict or tuple, if possible.

update_struct(...): Constructs a new structure with new values for fields in kwargs.