View source on GitHub |
Structure containing info on the tf.Tensor
shape/dtype.
tfds.features.TensorInfo(
shape: Shape,
dtype: type_utils.TfdsDType,
default_value=None,
sequence_rank: Optional[int] = None,
dataset_lvl: int = 0
)
Args | |
---|---|
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 .
|
Attributes | |
---|---|
dataset_lvl
|
|
default_value
|
|
dtype
|
Return the TensorFlow DType of this TensorInfo. |
np_dtype
|
|
numpy_dtype
|
|
sequence_rank
|
|
shape
|
|
tf_dtype
|
Methods
copy_from
@classmethod
copy_from( tensor_info: TensorInfo ) -> TensorInfo
Copy constructor.
from_tensor_spec
@classmethod
from_tensor_spec( tensor_spec: tf.TensorSpec ) -> TensorInfo
to_tensor_spec
to_tensor_spec() -> tf.TensorSpec
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__
__eq__(
other
)
Equality.