[tfds] Fix tfds.as_numpy which now returns a reusable iterable.

`next(ds)` -> `next(iter(ds))`

Context: https://github.com/tensorflow/datasets/issues/2270
PiperOrigin-RevId: 324951455
This commit is contained in:
A. Unique TensorFlower 2020-08-04 21:24:33 -07:00 committed by Steve Chien
parent 29651216cd
commit 191f2461c5

View file

@ -139,8 +139,8 @@ def load_data():
test_dataset = tfds.load(name='lm1b/subwords8k',
split=tfds.Split.TEST,
batch_size=10000)
train_data = next(tfds.as_numpy(train_dataset))
test_data = next(tfds.as_numpy(test_dataset))
train_data = next(iter(tfds.as_numpy(train_dataset)))
test_data = next(iter(tfds.as_numpy(test_dataset)))
train_data = train_data['text'].flatten()
test_data = test_data['text'].flatten()
else: