| 460 | } |
| 461 | |
| 462 | void Graph::finalize() |
| 463 | { |
| 464 | if (dirty) |
| 465 | planAllocs(); |
| 466 | |
| 467 | for (const auto& opTensorAllocPair : tensorAllocs) |
| 468 | { |
| 469 | auto& alloc = opTensorAllocPair.second; |
| 470 | const size_t byteOffset = tensorScratchPlanner.getAllocByteOffset(alloc->id); |
| 471 | alloc->tensor = scratch->newTensor(alloc->desc, tensorScratchByteOffset + byteOffset); |
| 472 | } |
| 473 | |
| 474 | for (auto& lazyInit : lazyInits) |
| 475 | lazyInit(); |
| 476 | |
| 477 | for (auto& op : ops) |
| 478 | { |
| 479 | op->setScratch(scratch); |
| 480 | op->finalize(); |
| 481 | } |
| 482 | |
| 483 | cleanup(); |
| 484 | constTensors.reset(); |
| 485 | cachedConstTensors.reset(); |
| 486 | |
| 487 | finalized = true; |
| 488 | } |
| 489 | |
| 490 | void Graph::submit(const Ref<Progress>& progress) |
| 491 | { |
no test coverage detected