Wraps a V2 `Dataset` object in the `tf.compat.v1.data.Dataset` API.
| 2096 | |
| 2097 | |
| 2098 | class DatasetV1Adapter(DatasetV1): |
| 2099 | """Wraps a V2 `Dataset` object in the `tf.compat.v1.data.Dataset` API.""" |
| 2100 | |
| 2101 | def __init__(self, dataset): |
| 2102 | self._dataset = dataset |
| 2103 | super(DatasetV1Adapter, self).__init__() |
| 2104 | |
| 2105 | def _as_variant_tensor(self): |
| 2106 | return self._dataset._variant_tensor # pylint: disable=protected-access |
| 2107 | |
| 2108 | def _has_captured_ref(self): |
| 2109 | return self._dataset._has_captured_ref() # pylint: disable=protected-access |
| 2110 | |
| 2111 | def _inputs(self): |
| 2112 | return self._dataset._inputs() # pylint: disable=protected-access |
| 2113 | |
| 2114 | def _functions(self): |
| 2115 | return self._dataset._functions() # pylint: disable=protected-access |
| 2116 | |
| 2117 | def options(self): |
| 2118 | return self._dataset.options() |
| 2119 | |
| 2120 | @property |
| 2121 | def element_spec(self): |
| 2122 | return self._dataset.element_spec # pylint: disable=protected-access |
| 2123 | |
| 2124 | def __iter__(self): |
| 2125 | return iter(self._dataset) |
| 2126 | |
| 2127 | |
| 2128 | def _ensure_same_dataset_graph(dataset): |
no outgoing calls
no test coverage detected