View source on GitHub

Class NamedTupleType

An implementation of tff.Type representing named tuple types in TFF.

Inherits From: Type

Used in the tutorials:

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


View source


Constructs a new instance from the given element types.


  • elements: Element specifications, in the format of a list, tuple, or collections.OrderedDict. Each element specification is either a type spec (an instance of tff.Type or something convertible to it via tff.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).



View source


Determines whether two type definitions are identical.

Note that this notion of equality is stronger than equivalence. Two types with equivalent definitions may not be identical, e.g., if they represent templates with differently named type variables in their definitions.


  • other: The other type to compare against.


True iff type definitions are syntatically identical (as defined above), or False otherwise.


  • NotImplementedError: If not implemented in the derived class.


View source



View source



View source



View source


Return self!=value.


View source


Returns the compact string representation of this type.


View source


Returns the formatted string representation of this type.