blob: 052b502194d3b35bf8ce8968f9a61f6a3f74f9c5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
#include "tensorflow/stream_executor/rng.h"
#include "tensorflow/stream_executor/platform/logging.h"
namespace perftools {
namespace gputools {
namespace rng {
bool RngSupport::CheckSeed(const uint8 *seed, uint64 seed_bytes) {
CHECK(seed != nullptr);
if (seed_bytes < kMinSeedBytes) {
LOG(INFO) << "Insufficient RNG seed data specified: " << seed_bytes
<< ". At least " << RngSupport::kMinSeedBytes
<< " bytes are required.";
return false;
}
if (seed_bytes > kMaxSeedBytes) {
LOG(INFO) << "Too much RNG seed data specified: " << seed_bytes
<< ". At most " << RngSupport::kMaxSeedBytes
<< " bytes may be provided.";
return false;
}
return true;
}
#if defined(__APPLE__)
const int RngSupport::kMinSeedBytes;
const int RngSupport::kMaxSeedBytes;
#endif
} // namespace rng
} // namespace gputools
} // namespace perftools
|