| 1529 | namespace { |
| 1530 | |
| 1531 | std::vector<string> InputDevices(const Node& caller) { |
| 1532 | std::vector<string> input_devices(caller.in_edges().size()); |
| 1533 | std::vector<string> input_tensors(caller.in_edges().size()); |
| 1534 | |
| 1535 | for (const Edge* edge : caller.in_edges()) { |
| 1536 | if (edge->IsControlEdge()) continue; |
| 1537 | const string& input_device = edge->src()->has_assigned_device_name() |
| 1538 | ? edge->src()->assigned_device_name() |
| 1539 | : edge->src()->requested_device(); |
| 1540 | input_devices[edge->dst_input()] = input_device; |
| 1541 | input_tensors[edge->dst_input()] = |
| 1542 | absl::StrCat(edge->src()->name(), ":", edge->src_output()); |
| 1543 | } |
| 1544 | |
| 1545 | if (VLOG_IS_ON(4)) { |
| 1546 | VLOG(4) << "Function instantiation input devices:"; |
| 1547 | for (int i = 0; i < input_devices.size(); ++i) { |
| 1548 | if (input_tensors[i].empty()) continue; // skip control edges |
| 1549 | VLOG(4) << " [index " << i << "]" |
| 1550 | << " device: " << input_devices[i] |
| 1551 | << " (input: " << input_tensors[i] << ")"; |
| 1552 | } |
| 1553 | } |
| 1554 | |
| 1555 | return input_devices; |
| 1556 | } |
| 1557 | |
| 1558 | // Place input nodes on the same device as the correspinding caller input |
| 1559 | // node. Do not specify any placement for all other nodes. |
no test coverage detected