tfds.features.TensorInfo

Structure containing info on the tf.Tensor shape/dtype.

shape tuple[int], shape of the tensor.
dtype Tensor DType that will be converted to NumPy DType.
default_value Used for retrocompatibility with previous files if a new field is added to provide a default value when reading the file.
sequence_rank int, Number of tfds.features.Sequence dimension.
dataset_lvl int, if >0, nesting level of a tfds.features.Dataset.

dataset_lvl

default_value

dtype Return the TensorFlow DType of this TensorInfo.
np_dtype

numpy_dtype

sequence_rank

shape

tf_dtype

Methods

copy_from

View source

Copy constructor.

from_tensor_spec

View source

to_tensor_spec

View source

Converts this TensorInfo instance to a tf.TensorSpec.

Note that there is a bug (b/227584124) around RaggedTensorSpec, so the output for sequences of sequences may not be correct.

Returns
The tf.TensorSpec corresponding to this instance.

__eq__

View source

Equality.