A `Dataset` that repeats its input several times.
| 2986 | |
| 2987 | |
| 2988 | class RepeatDataset(UnaryUnchangedStructureDataset): |
| 2989 | """A `Dataset` that repeats its input several times.""" |
| 2990 | |
| 2991 | def __init__(self, input_dataset, count): |
| 2992 | """See `Dataset.repeat()` for details.""" |
| 2993 | self._input_dataset = input_dataset |
| 2994 | if count is None: |
| 2995 | self._count = constant_op.constant(-1, dtype=dtypes.int64, name="count") |
| 2996 | else: |
| 2997 | self._count = ops.convert_to_tensor( |
| 2998 | count, dtype=dtypes.int64, name="count") |
| 2999 | variant_tensor = gen_dataset_ops.repeat_dataset( |
| 3000 | input_dataset._variant_tensor, # pylint: disable=protected-access |
| 3001 | count=self._count, |
| 3002 | **self._flat_structure) |
| 3003 | super(RepeatDataset, self).__init__(input_dataset, variant_tensor) |
| 3004 | |
| 3005 | |
| 3006 | class RangeDataset(DatasetSource): |