|View source on GitHub|
An implementation of
tff.Type representing federated types in TFF.
Used in the tutorials:
- Custom Federated Algorithms, Part 1: Introduction to the Federated Core
- Custom Federated Algorithms, Part 2: Implementing Federated Averaging
__init__( member, placement, all_equal=None )
Constructs a new federated type instance.
member: An instance of
tff.Type(or something convertible to it) that represents the type of the member components of each value of this federated type.
placement: The specification of placement that the member components of this federated type are hosted on. Must be either a placement literal such as
tff.CLIENTSto refer to a globally defined placement, or a placement label to refer to a placement defined in other parts of a type signature. Specifying placement labels is not implemented yet.
boolvalue that indicates whether all members of the federated type are equal (
True), or are allowed to differ (
None, the value is selected as the default for the placement, e.g.,
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),
NotImplementedError: If not implemented in the derived class.
Returns the compact string representation of this type.
Returns the formatted string representation of this type.