Commit a3650434 authored by Derek Murray's avatar Derek Murray Committed by TensorFlower Gardener
Browse files

[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
parent 1c850ad2
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment