Missed TensorFlow Dev Summit? Check out the video playlist. Watch recordings

tff.NamedTupleType

View source on GitHub

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

Inherits From: Type

tff.NamedTupleType(
    elements
)

Used in the notebooks

Used in the tutorials

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

Args:

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

Methods

__eq__

View source

__eq__(
    other
)

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.

Args:

  • other: The other type to compare against.

Returns:

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

Raises:

  • NotImplementedError: If not implemented in the derived class.

__getitem__

View source

__getitem__(
    key
)

__iter__

View source

__iter__()

__len__

View source

__len__()

__ne__

View source

__ne__(
    other
)

Return self!=value.

compact_representation

View source

compact_representation()

Returns the compact string representation of this type.

formatted_representation

View source

formatted_representation()

Returns the formatted string representation of this type.