| 423 | } |
| 424 | |
| 425 | Status MklToTfConversionPass::Run(const GraphOptimizationPassOptions& options) { |
| 426 | if (options.graph == nullptr && options.partition_graphs == nullptr) { |
| 427 | return Status::OK(); |
| 428 | } |
| 429 | if (DisableMKL()) { |
| 430 | VLOG(2) << "TF-MKL: Disabling MKL"; |
| 431 | return Status::OK(); |
| 432 | } |
| 433 | |
| 434 | auto process_graph = [&](std::unique_ptr<Graph>* g) { |
| 435 | // Get the ownership of graph |
| 436 | std::unique_ptr<Graph>* ng = std::move(g); |
| 437 | RunPass(ng); |
| 438 | // Return the ownership of graph back |
| 439 | g->reset(ng->release()); |
| 440 | }; |
| 441 | |
| 442 | if (kMklTfConvPassGroup != OptimizationPassRegistry::POST_PARTITIONING) { |
| 443 | // For any pre-partitioning phase, graph is stored in options.graph. |
| 444 | process_graph(options.graph); |
| 445 | } else { |
| 446 | // For post partitioning phase, graphs are stored in |
| 447 | // options.partition_graphs. |
| 448 | for (auto& pg : *options.partition_graphs) { |
| 449 | process_graph(&pg.second); |
| 450 | } |
| 451 | } |
| 452 | |
| 453 | return Status::OK(); |
| 454 | } |
| 455 | |
| 456 | } // namespace tensorflow |
| 457 |
nothing calls this directly
no test coverage detected