MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / InputDevices

Function InputDevices

tensorflow/core/common_runtime/function.cc:1531–1556  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1529namespace {
1530
1531std::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.

Callers 2

Calls 9

nameMethod · 0.65
StrCatFunction · 0.50
sizeMethod · 0.45
IsControlEdgeMethod · 0.45
srcMethod · 0.45
dst_inputMethod · 0.45
src_outputMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected