Missed TensorFlow World? Check out the recap. Learn more

tff.TensorType

View source on GitHub

Class TensorType

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

Inherits From: Type

__init__

View source

__init__(
    dtype,
    shape=None
)

Constructs a new instance from the given dtype and shape.

Args:

  • dtype: An instance of tf.DType.
  • shape: An optional instance of tf.TensorShape or an argument that can be passed to its constructor (such as a list or a tuple), or None for the default scalar shape. TensorShapes with unknown rank are not supported.

Raises:

  • TypeError: if arguments are of the wrong types.

Properties

dtype

shape

Methods

__eq__

View source

__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 iff type definitions are syntatically identical (as defined above), or False otherwise.

Raises:

  • NotImplementedError: If not implemented in the derived class.

__ne__

View source

__ne__(other)

Return self!=value.

compact_representation

View source

compact_representation()

Returns the compact string representation of this type.

formatted_representation

View source

formatted_representation()

Returns the formatted string representation of this type.