# Module: tff.types

<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/federated/blob/v0.87.0 Version 2.0, January 2004 Licensed under the Apache License, Version 2.0 (the) |

Libraries for interacting with the type of a computation.

## Classes

[`class AbstractType`](https://www.tensorflow.org/federated/api_docs/python/tff/types/AbstractType): An implementation of [`tff.Type`](https://www.tensorflow.org/federated/api_docs/python/tff/types/Type) representing abstract types in TFF.

[`class FederatedType`](https://www.tensorflow.org/federated/api_docs/python/tff/types/FederatedType): An implementation of [`tff.Type`](https://www.tensorflow.org/federated/api_docs/python/tff/types/Type) representing federated types in TFF.

[`class FunctionType`](https://www.tensorflow.org/federated/api_docs/python/tff/types/FunctionType): An implementation of [`tff.Type`](https://www.tensorflow.org/federated/api_docs/python/tff/types/Type) representing functional types in TFF.

[`class PlacementType`](https://www.tensorflow.org/federated/api_docs/python/tff/types/PlacementType): An implementation of [`tff.Type`](https://www.tensorflow.org/federated/api_docs/python/tff/types/Type) representing the placement type in TFF.

[`class SequenceType`](https://www.tensorflow.org/federated/api_docs/python/tff/types/SequenceType): An implementation of [`tff.Type`](https://www.tensorflow.org/federated/api_docs/python/tff/types/Type) representing types of sequences in TFF.

[`class StructType`](https://www.tensorflow.org/federated/api_docs/python/tff/types/StructType): An implementation of [`tff.Type`](https://www.tensorflow.org/federated/api_docs/python/tff/types/Type) representing structural types in TFF.

[`class StructWithPythonType`](https://www.tensorflow.org/federated/api_docs/python/tff/types/StructWithPythonType): A representation of a structure paired with a Python container type.

[`class TensorType`](https://www.tensorflow.org/federated/api_docs/python/tff/types/TensorType): An implementation of [`tff.Type`](https://www.tensorflow.org/federated/api_docs/python/tff/types/Type) representing types of tensors in TFF.

[`class Type`](https://www.tensorflow.org/federated/api_docs/python/tff/types/Type): An abstract interface for all classes that represent TFF types.

[`class TypeNotAssignableError`](https://www.tensorflow.org/federated/api_docs/python/tff/types/TypeNotAssignableError): Inappropriate argument type.

[`class TypeRelation`](https://www.tensorflow.org/federated/api_docs/python/tff/types/TypeRelation): An enumeration.

[`class TypesNotEquivalentError`](https://www.tensorflow.org/federated/api_docs/python/tff/types/TypesNotEquivalentError): Inappropriate argument type.

[`class TypesNotIdenticalError`](https://www.tensorflow.org/federated/api_docs/python/tff/types/TypesNotIdenticalError): Inappropriate argument type.

[`class UnexpectedTypeError`](https://www.tensorflow.org/federated/api_docs/python/tff/types/UnexpectedTypeError): Inappropriate argument type.

## Functions

[`contains(...)`](https://www.tensorflow.org/federated/api_docs/python/tff/types/contains): Checks if `type_signature` contains any types that pass `predicate`.

[`contains_only(...)`](https://www.tensorflow.org/federated/api_docs/python/tff/types/contains_only): Checks if `type_signature` contains only types that pass `predicate`.

[`count(...)`](https://www.tensorflow.org/federated/api_docs/python/tff/types/count): Returns the number of types in `type_signature` matching `predicate`.

[`deserialize_type(...)`](https://www.tensorflow.org/federated/api_docs/python/tff/types/deserialize_type): Deserializes 'type_proto' as a [`tff.Type`](https://www.tensorflow.org/federated/api_docs/python/tff/types/Type).

[`is_shape_fully_defined(...)`](https://www.tensorflow.org/federated/api_docs/python/tff/types/is_shape_fully_defined): Returns `True` if `shape` is fully defined, False otherwise.

[`is_structure_of_floats(...)`](https://www.tensorflow.org/federated/api_docs/python/tff/types/is_structure_of_floats): Determines if `type_spec` is a structure of floats.

[`is_structure_of_integers(...)`](https://www.tensorflow.org/federated/api_docs/python/tff/types/is_structure_of_integers): Determines if `type_spec` is a structure of integers.

[`is_structure_of_tensors(...)`](https://www.tensorflow.org/federated/api_docs/python/tff/types/is_structure_of_tensors)

[`is_tensorflow_compatible_type(...)`](https://www.tensorflow.org/federated/api_docs/python/tff/types/is_tensorflow_compatible_type): Checks `type_spec` against an explicit list of `tf_computation`.

[`num_elements_in_shape(...)`](https://www.tensorflow.org/federated/api_docs/python/tff/types/num_elements_in_shape): Returns the number of elements in `shape`, or `None` if not fully defined.

[`serialize_type(...)`](https://www.tensorflow.org/federated/api_docs/python/tff/types/serialize_type): Serializes 'type_spec' as a pb.Type.

[`structure_from_tensor_type_tree(...)`](https://www.tensorflow.org/federated/api_docs/python/tff/types/structure_from_tensor_type_tree): Constructs a structure from a `type_spec` tree of [`tff.TensorType`](https://www.tensorflow.org/federated/api_docs/python/tff/types/TensorType)s.

[`tensorflow_to_type(...)`](https://www.tensorflow.org/federated/api_docs/python/tff/types/tensorflow_to_type): Returns a [`tff.Type`](https://www.tensorflow.org/federated/api_docs/python/tff/types/Type) for an `obj` containing TensorFlow type specs.

[`to_type(...)`](https://www.tensorflow.org/federated/api_docs/python/tff/types/to_type): Converts the argument into an instance of [`tff.Type`](https://www.tensorflow.org/federated/api_docs/python/tff/types/Type).

[`type_mismatch_error_message(...)`](https://www.tensorflow.org/federated/api_docs/python/tff/types/type_mismatch_error_message): Returns an error message describing the mismatch between two types.

[`type_to_py_container(...)`](https://www.tensorflow.org/federated/api_docs/python/tff/types/type_to_py_container): Recursively convert [`structure.Struct`](https://www.tensorflow.org/federated/api_docs/python/tff/structure/Struct)s to Python containers.

[`type_to_tf_tensor_specs(...)`](https://www.tensorflow.org/federated/api_docs/python/tff/types/type_to_tf_tensor_specs): Returns nested structure of [`tf.TensorSpec`](https://www.tensorflow.org/api_docs/python/tf/TensorSpec)s for a given TFF type.

## Type Aliases

[`ArrayShape`](https://www.tensorflow.org/federated/api_docs/python/tff/types/ArrayShape)