Thanks for tuning in to Google I/O. View all sessions on demandWatch on demand

tff.types.TensorType

An implementation of tff.Type representing types of tensors in TFF.

Inherits From: Type

Used in the notebooks

Used in the tutorials

dtype An instance of tf.dtypes.DType or one of the Numpy numeric types.
shape An optional instance of tf.TensorShape or an argument that can be passed to its constructor (such as a list or a tuple). None yields the default scalar shape.

TypeError if arguments are of the wrong types.

dtype

shape

Methods

check_abstract

View source

Check that this is a tff.AbstractType.

check_assignable_from

View source

Raises if values of source_type cannot be cast to this type.

check_equivalent_to

View source

Raises if values of 'other' cannot be cast to and from this type.

check_federated

View source

Check that this is a tff.FederatedType.

check_function

View source

Check that this is a tff.FunctionType.

check_identical_to

View source

Raises if other and Type are not exactly identical.

check_placement

View source

Check that this is a tff.PlacementType.

check_sequence

View source

Check that this is a tff.SequenceType.

check_struct

View source

Check that this is a tff.StructType.

check_struct_with_python

View source

Check that this is a tff.StructWithPythonType.

check_tensor

View source

Check that this is a tff.TensorType.

children

View source

Returns a generator yielding immediate child types.

compact_representation

View source

Returns the compact string representation of this type.

formatted_representation

View source

Returns the formatted string representation of this type.

is_abstract

View source

Returns whether or not this type is a tff.AbstractType.

is_assignable_from

View source

Returns whether values of source_type can be cast to this type.

is_equivalent_to

View source

Returns whether values of other can be cast to and from this type.

is_federated

View source

Returns whether or not this type is a tff.FederatedType.

is_function

View source

Returns whether or not this type is a tff.FunctionType.

is_identical_to

View source

Returns whether or not self and other are exactly identical.

is_placement

View source

Returns whether or not this type is a tff.PlacementType.

is_sequence

View source

Returns whether or not this type is a tff.SequenceType.

is_struct

View source

Returns whether or not this type is a tff.StructType.

is_struct_with_python

View source

Returns whether or not this type is a tff.StructWithPythonType.

is_tensor

View source

Returns whether or not this type is a tff.TensorType.

__eq__

View source

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.

__ne__

View source

Return self!=value.