Skip to content

Commit e57f236

Browse files
authored
More explicit variable names
1 parent 49c1a80 commit e57f236

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

tensorflow_datasets/core/dataset_builder.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -327,32 +327,32 @@ def as_dataset(self,
327327
ds_builder.download_and_prepare()
328328
329329
# Default parameters
330-
ds1 = ds_builder.as_dataset()
331-
assert isinstance(ds1, dict)
332-
print(ds1.keys()) # ==> ['test', 'train', 'unsupervised']
330+
ds_all_dict = ds_builder.as_dataset()
331+
assert isinstance(ds_all_dict, dict)
332+
print(ds_all_dict.keys()) # ==> ['test', 'train', 'unsupervised']
333333
334-
assert isinstance(ds1[tfds.Split.TEST], tf.data.Dataset)
334+
assert isinstance(ds_all_dict[tfds.Split.TEST], tf.data.Dataset)
335335
# Each dataset (test, train, unsup.) consists of dictionaries
336336
# {'label': <tf.Tensor: .. dtype=int64, numpy=1>,
337337
# 'text': <tf.Tensor: .. dtype=string, numpy=b"I've watched the movie ..">}
338338
# {'label': <tf.Tensor: .. dtype=int64, numpy=1>,
339339
# 'text': <tf.Tensor: .. dtype=string, numpy=b'If you love Japanese ..'>}
340340
341341
# Only (feature, label) tuples specified in this particular DatasetBuilder
342-
ds2 = ds_builder.as_dataset(as_supervised=True)
343-
assert isinstance(ds2, dict)
344-
print(ds2.keys()) # ==> ['test', 'train', 'unsupervised']
342+
ds_all_supervised = ds_builder.as_dataset(as_supervised=True)
343+
assert isinstance(ds_all_supervised, dict)
344+
print(ds_all_supervised.keys()) # ==> ['test', 'train', 'unsupervised']
345345
346-
assert isinstance(ds2[tfds.Split.TEST], tf.data.Dataset)
346+
assert isinstance(ds_all_supervised[tfds.Split.TEST], tf.data.Dataset)
347347
# Each dataset (test, train, unsup.) consists of tuples (text, label)
348348
# (<tf.Tensor: ... dtype=string, numpy=b"I've watched the movie ..">,
349349
# <tf.Tensor: ... dtype=int64, numpy=1>)
350350
# (<tf.Tensor: ... dtype=string, numpy=b"If you love Japanese ..">,
351351
# <tf.Tensor: ... dtype=int64, numpy=1>)
352352
353353
# Same as above plus requesting a particular split
354-
ds3 = ds_builder.as_dataset(as_supervised=True, split=tfds.Split.TEST)
355-
assert isinstance(ds3, tf.data.Dataset)
354+
ds_test_supervised = ds_builder.as_dataset(as_supervised=True, split=tfds.Split.TEST)
355+
assert isinstance(ds_test_supervised, tf.data.Dataset)
356356
# The dataset consists of tuples (text, label)
357357
# (<tf.Tensor: ... dtype=string, numpy=b"I've watched the movie ..">,
358358
# <tf.Tensor: ... dtype=int64, numpy=1>)

0 commit comments

Comments
 (0)