287cfc0730dfaa73d868a42b0715d5d1cbcc94c0,tensorflow_datasets/core/dataset_builder_test.py,DatasetBuilderTest,test_determinism,#DatasetBuilderTest#,122
Before Change
@testing.run_in_graph_and_eager_modes()
def test_determinism(self):
with testing.tmp_dir(self.get_temp_dir()) as tmp_dir:
ds = registered.load(
name="dummy_dataset_shared_generator",
data_dir=tmp_dir,
split=splits_lib.Split.TRAIN,
shuffle_files=False)
ds_values = list(dataset_utils.as_numpy(ds))
// Ensure determinism. If this test fail, this mean that numpy random
// module isn"t always determinist (maybe between version, architecture,
// ...), and so our datasets aren"t guaranteed either.
l = list(range(20))
np.random.RandomState(42).shuffle(l)
self.assertEqual(l, [
0, 17, 15, 1, 8, 5, 11, 3, 18, 16, 13, 2, 9, 19, 4, 12, 7, 10, 14, 6
])
// Ensure determinism. If this test fails, this mean the dataset are not
// deterministically generated.
self.assertEqual(
[e["x"] for e in ds_values],
[6, 16, 19, 12, 14, 18, 5, 13, 15, 4, 10, 17, 0, 8, 3, 1, 9, 7, 11,
2],
)
@testing.run_in_graph_and_eager_modes()
def test_load_from_gcs(self):
from tensorflow_datasets.image_classification import mnist // pylint:disable=import-outside-toplevel,g-import-not-at-top
with testing.tmp_dir(self.get_temp_dir()) as tmp_dir:
After Change
@testing.run_in_graph_and_eager_modes()
def test_determinism(self):
ds = self.builder.as_dataset(
split=splits_lib.Split.TRAIN, shuffle_files=False)
ds_values = list(dataset_utils.as_numpy(ds))
// Ensure determinism. If this test fail, this mean that numpy random
// module isn"t always determinist (maybe between version, architecture,
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 8
Instances Project Name: tensorflow/datasets
Commit Name: 287cfc0730dfaa73d868a42b0715d5d1cbcc94c0
Time: 2020-04-07
Author: epot@google.com
File Name: tensorflow_datasets/core/dataset_builder_test.py
Class Name: DatasetBuilderTest
Method Name: test_determinism
Project Name: tensorflow/datasets
Commit Name: 287cfc0730dfaa73d868a42b0715d5d1cbcc94c0
Time: 2020-04-07
Author: epot@google.com
File Name: tensorflow_datasets/core/dataset_builder_test.py
Class Name: DatasetBuilderTest
Method Name: test_multi_split
Project Name: tensorflow/datasets
Commit Name: 287cfc0730dfaa73d868a42b0715d5d1cbcc94c0
Time: 2020-04-07
Author: epot@google.com
File Name: tensorflow_datasets/core/dataset_builder_test.py
Class Name: DatasetBuilderTest
Method Name: test_read_config