![]() |
An abstract interface for all classes that represent TFF types.
Methods
check_abstract
check_abstract() -> None
Check that this is a tff.AbstractType
.
check_assignable_from
check_assignable_from(
source_type: 'Type'
) -> None
Raises if values of source_type
cannot be cast to this type.
check_equivalent_to
check_equivalent_to(
other: 'Type'
) -> None
Raises if values of 'other' cannot be cast to and from this type.
check_federated
check_federated() -> None
Check that this is a tff.FederatedType
.
check_function
check_function() -> None
Check that this is a tff.FunctionType
.
check_identical_to
check_identical_to(
other: 'Type'
) -> None
Raises if other
and Type
are not exactly identical.
check_placement
check_placement() -> None
Check that this is a tff.PlacementType
.
check_sequence
check_sequence() -> None
Check that this is a tff.SequenceType
.
check_struct
check_struct() -> None
Check that this is a tff.StructType
.
check_struct_with_python
check_struct_with_python() -> None
Check that this is a tff.StructWithPythonType
.
check_tensor
check_tensor() -> None
Check that this is a tff.TensorType
.
children
@abc.abstractmethod
children() -> Iterator['Type']
Returns a generator yielding immediate child types.
compact_representation
compact_representation() -> str
Returns the compact string representation of this type.
formatted_representation
formatted_representation() -> str
Returns the formatted string representation of this type.
is_assignable_from
@abc.abstractmethod
is_assignable_from( source_type: 'Type' ) -> bool
Returns whether values of source_type
can be cast to this type.
is_equivalent_to
is_equivalent_to(
other: 'Type'
) -> bool
Returns whether values of other
can be cast to and from this type.
is_identical_to
is_identical_to(
other: 'Type'
) -> bool
Returns whether or not self
and other
are exactly identical.
__eq__
@abc.abstractmethod
__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 if type definitions are syntactically identical (as defined above),
otherwise False .
|
Raises | |
---|---|
NotImplementedError
|
If not implemented in the derived class. |
__ne__
__ne__(
other
)
Return self!=value.