| 441 | } |
| 442 | |
| 443 | Node* Encapsulator::Subgraph::MakeNodeImage(const Graph* graph_in, Node* node) { |
| 444 | if (!graph_) { |
| 445 | graph_.reset(new Graph(graph_in->op_registry())); |
| 446 | graph_->set_versions(graph_in->versions()); |
| 447 | } |
| 448 | |
| 449 | // TODO(b/116981129): Enhance how the device for the encapsulated subgraph is |
| 450 | // determined. In case of hard placement, ensure all the encapsulated nodes |
| 451 | // have the same requested device, which in turn will be the requested device |
| 452 | // for the entire encapsulated subgraph. In case of soft placement, use a |
| 453 | // deterministic approach to fill in the requested device. Handle co-location |
| 454 | // constraints similarly if they exist. |
| 455 | if (device_.empty()) { |
| 456 | device_ = node->assigned_device_name().empty() |
| 457 | ? node->requested_device() |
| 458 | : node->assigned_device_name(); |
| 459 | } |
| 460 | |
| 461 | return graph_->CopyNode(node); |
| 462 | } |
| 463 | |
| 464 | Graph* Encapsulator::Subgraph::GetGraph() const { return graph_.get(); } |
| 465 |
no test coverage detected