[tf.data] Enable `tf.data.experimental.Optional` as a dataset component.
This change introduces `DatasetStructure` as a `Structure` subclass for representing the structure of a `Dataset` value, and changes the representation of "legacy structures" for non-Tensor components to use the new class. Previously, a nested `Dataset` was represented by a `_NestedDatasetComponent` that appeared at the same position in `Dataset.output_types`, `Dataset.output_shapes`, and `Dataset.output_classes`. After this change, we allow a `Structure` object to substitute for `_NestedDatasetComponent`. Thus `DatasetStructure` becomes the direct replacement for `_NestedDatasetComponent`, and `OptionalStructure` can be used in the same position to represent an `Optional` as a component of a dataset element. PiperOrigin-RevId: 222273133
Loading
Please sign in to comment