ML Community Day is November 9! Join us for updates from TensorFlow, JAX, and more Learn more

tf.TensorSpec

Describes a tf.Tensor.

Inherits From: TypeSpec

Used in the notebooks

Used in the guide Used in the tutorials

Metadata for describing the tf.Tensor objects accepted or returned by some TensorFlow APIs.

shape Value convertible to tf.TensorShape. The shape of the tensor.
dtype Value convertible to tf.DType. The type of the tensor values.
name Optional name for the Tensor.

TypeError If shape is not convertible to a tf.TensorShape, or dtype is not convertible to a tf.DType.