| 27 | namespace one { |
| 28 | |
| 29 | Maybe<void> SyncAccessTensorWithTimeOut( |
| 30 | const std::shared_ptr<Tensor>& tensor, |
| 31 | const std::function<void(ep::Stream*, const std::shared_ptr<vm::EagerBlobObject>&)>& Callback, |
| 32 | const std::string& modifier) { |
| 33 | auto btb = std::make_shared<BlockingThenBusy>(); |
| 34 | auto local_tensor = JUST(tensor->AsLocalTensor()); |
| 35 | JUST(PhysicalRun([&](InstructionsBuilder* builder) -> Maybe<void> { |
| 36 | return builder->SyncAccessBlobByCallback(local_tensor, btb, Callback, modifier); |
| 37 | })); |
| 38 | JUST(btb->WaitUntilCntEqualZero(VirtualMachine::GetPredicatorNoMoreInstructionsFinished())); |
| 39 | return Maybe<void>::Ok(); |
| 40 | } |
| 41 | |
| 42 | Maybe<void> CopyLocalTensorDataTo(const std::shared_ptr<Tensor>& input, void* mem_ptr, |
| 43 | size_t size) { |
no test coverage detected