Skip to content

Commit 0e25f92

Browse files
tutmanntensorflower-gardener
authored andcommitted
Internal change
PiperOrigin-RevId: 520099200
1 parent 1fb2d00 commit 0e25f92

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

official/core/input_reader.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -160,12 +160,15 @@ def _read_tfds(tfds_name: Text,
160160
cycle_length: Optional[int] = None,
161161
block_length: Optional[int] = None) -> tf.data.Dataset:
162162
"""Reads a dataset from tfds."""
163+
repeat_filenames = is_training and not cache
163164
read_config = tfds.ReadConfig(
164165
interleave_cycle_length=cycle_length,
165166
interleave_block_length=block_length,
166167
input_context=input_context,
167168
shuffle_seed=seed,
168-
repeat_filenames=is_training and not cache,
169+
repeat_filenames=repeat_filenames,
170+
# Only assert cardinality when we have a finite dataset.
171+
assert_cardinality=not repeat_filenames,
169172
skip_prefetch=True)
170173

171174
decoders = {}

0 commit comments

Comments
 (0)