@@ -0,0 +1,2116 @@
+# Copyright 2020 The TensorFlow Authors. All Rights Reserved.%0A#%0A# Licensed under the Apache License, Version 2.0 (the %22License%22);%0A# you may not use this file except in compliance with the License.%0A# You may obtain a copy of the License at%0A#%0A#     http://www.apache.org/licenses/LICENSE-2.0%0A#%0A# Unless required by applicable law or agreed to in writing, software%0A# distributed under the License is distributed on an %22AS IS%22 BASIS,%0A# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A# See the License for the specific language governing permissions and%0A# limitations under the License.%0A# ==============================================================================%0A%22%22%22Tests for %60tf.data.Dataset.random()%60.%22%22%22%0Afrom __future__ import absolute_import%0Afrom __future__ import division%0Afrom __future__ import print_function%0A%0Afrom absl.testing import parameterized%0A%0Afrom tensorflow.python.data.kernel_tests import test_base%0Afrom tensorflow.python.data.ops import dataset_ops%0Afrom tensorflow.python.framework import combinations%0Afrom tensorflow.python.framework import random_seed%0Afrom tensorflow.python.platform import test%0A%0A%0Aclass RandomDatasetTest(test_base.DatasetTestBase, parameterized.TestCase):%0A%0A  @combinations.generate(%0A      combinations.times(%0A          test_base.default_test_combinations(),%0A          combinations.combine(global_seed=%5BNone, 10%5D, local_seed=%5BNone, 20%5D)))%0A  def testDeterminism(self, global_seed, local_seed):%0A    expect_determinism = (global_seed is not None) or (local_seed is not None)%0A%0A    random_seed.set_random_seed(global_seed)%0A    ds = dataset_ops.Dataset.random(seed=local_seed).take(10)%0A%0A    output_1 = self.getDatasetOutput(ds)%0A    ds = self.graphRoundTrip(ds)%0A    output_2 = self.getDatasetOutput(ds)%0A%0A    if expect_determinism:%0A      self.assertEqual(output_1, output_2)%0A    else:%0A      # Technically not guaranteed since the two randomly-chosen int64 seeds%0A      # could match, but that is sufficiently unlikely (1/2%5E128 with perfect%0A      # random number generation).%0A      self.assertNotEqual(output_1, output_2)%0A%0A%0Aif __name__ == %22__main__%22:%0A  test.main()

modify api usage in random_dataset_test.py