View source on GitHub |
Libraries for interacting with the type of a computation.
Classes
class AbstractType
: An implementation of tff.Type
representing abstract types in TFF.
class FederatedType
: An implementation of tff.Type
representing federated types in TFF.
class FunctionType
: An implementation of tff.Type
representing functional types in TFF.
class PlacementType
: An implementation of tff.Type
representing the placement type in TFF.
class SequenceType
: An implementation of tff.Type
representing types of sequences in TFF.
class StructType
: An implementation of tff.Type
representing structural types in TFF.
class StructWithPythonType
: A representation of a structure paired with a Python container type.
class TensorType
: An implementation of tff.Type
representing types of tensors in TFF.
class Type
: An abstract interface for all classes that represent TFF types.
class TypeNotAssignableError
: Inappropriate argument type.
class TypeRelation
: An enumeration.
class TypesNotEquivalentError
: Inappropriate argument type.
class TypesNotIdenticalError
: Inappropriate argument type.
class UnexpectedTypeError
: Inappropriate argument type.
Functions
contains(...)
: Checks if type_signature
contains any types that pass predicate
.
contains_only(...)
: Checks if type_signature
contains only types that pass predicate
.
count(...)
: Returns the number of types in type_signature
matching predicate
.
deserialize_type(...)
: Deserializes 'type_proto' as a tff.Type
.
is_shape_fully_defined(...)
: Returns True
if shape
is fully defined, False otherwise.
is_structure_of_floats(...)
: Determines if type_spec
is a structure of floats.
is_structure_of_integers(...)
: Determines if type_spec
is a structure of integers.
is_tensorflow_compatible_type(...)
: Checks type_spec
against an explicit list of tf_computation
.
num_elements_in_shape(...)
: Returns the number of elements in shape
, or None
if not fully defined.
serialize_type(...)
: Serializes 'type_spec' as a pb.Type.
structure_from_tensor_type_tree(...)
: Constructs a structure from a type_spec
tree of tff.TensorType
s.
tensorflow_to_type(...)
: Returns a tff.Type
for an obj
containing TensorFlow type specs.
to_type(...)
: Converts the argument into an instance of tff.Type
.
type_mismatch_error_message(...)
: Returns an error message describing the mismatch between two types.
type_to_py_container(...)
: Recursively convert structure.Struct
s to Python containers.
type_to_tf_tensor_specs(...)
: Returns nested structure of tf.TensorSpec
s for a given TFF type.