MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / Update

Method Update

tensorflow/core/kernels/incr_save_restore_ops.h:94–113  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

92 }
93
94 void Update(const Tensor& indices, OpKernelContext *ctx) {
95 const int64 N = indices.NumElements();
96 auto thread_pool = *(ctx->device()->tensorflow_cpu_worker_threads());
97
98 std::vector<std::pair<int64, int64>> parts;
99 SplitParallelParts(N,
100 std::min(part_count_, thread_pool.workers->NumThreads()), parts);
101
102 int part_count = parts.size();
103 BlockingCounter counter(part_count);
104 for (int i = 0; i < part_count; i++) {
105 int64 start = parts[i].first;
106 int64 end = parts[i].second;
107 thread_pool.workers->Schedule([this, indices, i, start, end, &counter]() {
108 hash_maps_[i].Update(indices, start, end);
109 counter.DecrementCount();
110 });
111 }
112 counter.Wait();
113 }
114
115 void Swap(std::unordered_map<T, uint64> &indices) {
116 std::vector<std::unordered_map<T, uint64>> tmp_maps;

Callers 1

UpdateIndicesMethod · 0.45

Calls 9

minFunction · 0.50
NumElementsMethod · 0.45
deviceMethod · 0.45
NumThreadsMethod · 0.45
sizeMethod · 0.45
ScheduleMethod · 0.45
DecrementCountMethod · 0.45
WaitMethod · 0.45

Tested by

no test coverage detected