| 53 | } |
| 54 | |
| 55 | bool DagNodeRunner::BuildInput( |
| 56 | const DagNode* node, Tape* tape, |
| 57 | Tensor::Map* tensors) { |
| 58 | for (auto& edge : node->InEdges()) { |
| 59 | auto src_node = edge->Src(); |
| 60 | auto record = tape->Retrieval(src_node->Id()); |
| 61 | if (record.size() == 0) { |
| 62 | LOG(ERROR) << "DagEdge has no src node: " << src_node->Id(); |
| 63 | return false; |
| 64 | } |
| 65 | |
| 66 | auto it = record.find(edge->SrcOutput()); |
| 67 | if (it == record.end()) { |
| 68 | LOG(ERROR) << "Invalid upstream: " << edge->SrcOutput(); |
| 69 | return false; |
| 70 | } else { |
| 71 | // Copy tensor instead of move, because one DagNode could have |
| 72 | // multiple downstream DagNodes. |
| 73 | tensors->emplace(edge->DstInput(), it->second); |
| 74 | } |
| 75 | } |
| 76 | return true; |
| 77 | } |
| 78 | |
| 79 | std::unique_ptr<OpResponse> DagNodeRunner::RunOp( |
| 80 | const DagNode* node, |