tff.types.StructType

An implementation of tff.Type representing structural types in TFF.

Inherits From: Struct, Type

Used in the notebooks

Used in the tutorials

Elements initialized by name can be accessed as foo.name, and otherwise by index, foo[index].

elements An iterable of element specifications. Each element specification is either a type spec (an instance of tff.Type or something convertible to it via tff.types.to_type) for the element, or a (name, spec) for elements that have defined names. Alternatively, one can supply here an instance of collections.OrderedDict mapping element names to their types (or things that are convertible to types).
convert A flag to determine if the elements should be converted using tff.types.to_type or not.

python_container

Methods

check_assignable_from

View source

Raises if values of source_type cannot be cast to this type.

check_equivalent_to

View source

Raises if values of 'other' cannot be cast to and from this type.

check_identical_to

View source

Raises if other and Type are not exactly identical.

children

View source

Returns a generator yielding immediate child types.

compact_representation

View source

Returns the compact string representation of this type.

formatted_representation

View source

Returns the formatted string representation of this type.

is_assignable_from

View source

Returns whether values of source_type can be cast to this type.

is_equivalent_to

View source

Returns whether values of other can be cast to and from this type.

is_identical_to

View source

Returns whether or not self and other are exactly identical.

named

View source

Constructs a new Struct with all named elements.

unnamed

View source

Constructs a new Struct with all unnamed elements.

__eq__

View source

Return self==value.

__getitem__

View source

__iter__

View source

__len__

View source

__ne__

View source

Return self!=value.