| 366 | }; |
| 367 | |
| 368 | OpTest::OpTest() { |
| 369 | // Creates a random-number generator for the test case. Use the value of |
| 370 | // --tf_xla_random_seed as the seed, if provided. |
| 371 | int64 s = tf_xla_random_seed; |
| 372 | unsigned int seed; |
| 373 | if (s <= 0) { |
| 374 | std::random_device random_device; |
| 375 | seed = random_device(); |
| 376 | } else { |
| 377 | seed = static_cast<unsigned int>(s); |
| 378 | } |
| 379 | LOG(ERROR) << "Random seed for test case: " << seed |
| 380 | << ". To reproduce the " |
| 381 | "results of this test, pass flag --tf_xla_random_seed=" |
| 382 | << seed; |
| 383 | generator_.reset(new std::mt19937(seed)); |
| 384 | |
| 385 | // Create a session with an empty graph. |
| 386 | SessionOptions session_options; |
| 387 | session_.reset(NewSession(session_options)); |
| 388 | GraphDef def; |
| 389 | TF_CHECK_OK(session_->Create(def)); |
| 390 | } |
| 391 | |
| 392 | void OpTest::Repeatedly(const std::function<TestResult(void)>& fn) { |
| 393 | int const max_repetitions = tf_xla_test_repetitions; |
nothing calls this directly
no test coverage detected