Splits elements of a dataset into multiple elements on the batch dimension. For example, if elements of the dataset are shaped `[B, a0, a1, ...]`, where `B` may vary for each input element, then for each element in the dataset, the unbatched dataset will contain `B` consecutive elements of
()
| 76 | |
| 77 | @deprecation.deprecated(None, "Use `tf.data.experimental.unbatch()`.") |
| 78 | def unbatch(): |
| 79 | """Splits elements of a dataset into multiple elements on the batch dimension. |
| 80 | |
| 81 | For example, if elements of the dataset are shaped `[B, a0, a1, ...]`, |
| 82 | where `B` may vary for each input element, then for each element in the |
| 83 | dataset, the unbatched dataset will contain `B` consecutive elements |
| 84 | of shape `[a0, a1, ...]`. |
| 85 | |
| 86 | ```python |
| 87 | # NOTE: The following example uses `{ ... }` to represent the contents |
| 88 | # of a dataset. |
| 89 | a = { ['a', 'b', 'c'], ['a', 'b'], ['a', 'b', 'c', 'd'] } |
| 90 | |
| 91 | a.apply(tf.data.experimental.unbatch()) == { |
| 92 | 'a', 'b', 'c', 'a', 'b', 'a', 'b', 'c', 'd'} |
| 93 | ``` |
| 94 | |
| 95 | Returns: |
| 96 | A `Dataset` transformation function, which can be passed to |
| 97 | `tf.data.Dataset.apply`. |
| 98 | """ |
| 99 | return batching.unbatch() |
| 100 | |
| 101 | |
| 102 | @deprecation.deprecated( |