| 352 | } |
| 353 | |
| 354 | void Graph::addOp(const Ref<Op>& op, |
| 355 | const std::vector<Ref<Op>>& srcOps, |
| 356 | bool concatSrcs) |
| 357 | { |
| 358 | if (finalized) |
| 359 | throw std::logic_error("graph cannot be changed after finalization"); |
| 360 | |
| 361 | const int opID = int(ops.size()); |
| 362 | |
| 363 | // Add the source tensor allocations as dependencies for the operation |
| 364 | std::vector<int> srcAllocIDs; |
| 365 | for (const auto& srcOp : srcOps) |
| 366 | srcAllocIDs.push_back(tensorAllocs[srcOp.get()]->id); |
| 367 | tensorScratchPlanner.addDepAllocs(opID, srcAllocIDs, concatSrcs); |
| 368 | |
| 369 | ops.push_back(op); |
| 370 | workAmount += op->getWorkAmount(); |
| 371 | dirty = true; |
| 372 | } |
| 373 | |
| 374 | std::shared_ptr<Graph::TensorAlloc> Graph::addOp( |
| 375 | const Ref<Op>& op, |
nothing calls this directly
no test coverage detected