MCPcopy Create free account
hub / github.com/Oneflow-Inc/oneflow / SyncAccessTensorWithTimeOut

Function SyncAccessTensorWithTimeOut

oneflow/core/framework/tensor_util.cpp:29–40  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

27namespace one {
28
29Maybe<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
42Maybe<void> CopyLocalTensorDataTo(const std::shared_ptr<Tensor>& input, void* mem_ptr,
43 size_t size) {

Callers 15

GetStateMethod · 0.85
SetStateMethod · 0.85
ExpandMaskIndexFunction · 0.85
GetTensorItemValueFunction · 0.85
_rnn_pack_sequence_implFunction · 0.85
_lstm_pack_sequence_implFunction · 0.85
operator()Method · 0.85
operator()Method · 0.85
operator()Method · 0.85
operator()Method · 0.85

Calls 4

PhysicalRunFunction · 0.85
AsLocalTensorMethod · 0.45
WaitUntilCntEqualZeroMethod · 0.45

Tested by

no test coverage detected