MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / TEST

Function TEST

tensorflow/core/lib/random/philox_random_test.cc:48–69  ·  view source on GitHub ↗

This test checks that skipping certain number of samples, is equivalent to generate the same number of samples without skipping.

Source from the content-addressed store, hash-verified

46// This test checks that skipping certain number of samples, is equivalent to
47// generate the same number of samples without skipping.
48TEST(PhiloxRandomTest, SkipMatchTest) {
49 constexpr int count = 1024;
50 constexpr int skip_count = 2048;
51
52 uint64 test_seed = GetTestSeed();
53 std::vector<uint32> v1(count);
54 {
55 PhiloxRandom gen(test_seed);
56 gen.Skip(skip_count / 4);
57 FillRandoms<TrivialPhiloxDistribution>(gen, &v1[0], v1.size());
58 }
59
60 std::vector<uint32> v2(count + skip_count);
61 {
62 PhiloxRandom gen(test_seed);
63 FillRandoms<TrivialPhiloxDistribution>(gen, &v2[0], v2.size());
64 }
65
66 for (int i = 0; i < count; ++i) {
67 ASSERT_EQ(v1[i], v2[i + skip_count]);
68 }
69}
70
71} // namespace
72} // namespace random

Callers

nothing calls this directly

Calls 3

GetTestSeedFunction · 0.85
SkipMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected