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

Method FOR_RANGE

oneflow/user/kernels/argmax_kernel.cpp:46–56  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

44 const BalancedSplitter bs(instance_num, num_thread);
45 BlockingCounter bc(num_thread);
46 FOR_RANGE(int64_t, thread_id, 0, num_thread) {
47 const Range range = bs.At(thread_id);
48 Singleton<ThreadPool>::Get()->AddWork([=, &bc]() {
49 FOR_RANGE(int64_t, i, range.begin(), range.end()) {
50 const T* in_ptr_i = in_ptr + i * instance_size;
51 out_ptr[i] =
52 std::distance(in_ptr_i, std::max_element(in_ptr_i, in_ptr_i + instance_size));
53 }
54 bc.Decrease();
55 });
56 }
57 bc.WaitForeverUntilCntEqualZero();
58 }
59 bool AlwaysComputeWhenAllOutputsEmpty() const override { return false; }

Callers

nothing calls this directly

Calls 4

GetFunction · 0.85
AddWorkMethod · 0.80
AtMethod · 0.45
DecreaseMethod · 0.45

Tested by

no test coverage detected