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

Method Add

tensorflow/core/kernels/record_yielder.cc:174–196  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

172}
173
174bool RecordYielder::Add(std::vector<string>* values) {
175 mutex_lock l(mu_);
176 while (!BufNotFull()) {
177 buf_not_full_.wait(l);
178 }
179 while (BufNotFull() && !values->empty()) {
180 // Adds values->back(). Swaps its position with another random
181 // element.
182 auto index = rnd_() % (buf_.size() + 1);
183 if (index == buf_.size()) {
184 buf_.push_back(std::move(values->back()));
185 } else {
186 buf_.push_back(std::move(buf_[index]));
187 buf_[index] = std::move(values->back());
188 }
189 values->pop_back();
190 num_records_added_in_epoch_++;
191 }
192 if (BufEnough()) {
193 buf_enough_.notify_all();
194 }
195 return stop_;
196}
197
198void RecordYielder::ShardLoop(Shard* shard) {
199 std::vector<string> values;

Callers 15

WriteCheckpointFunction · 0.45
ComputeMethod · 0.45
ComputeMethod · 0.45
ComputeMethod · 0.45
ComputeMethod · 0.45
ProcessBatchMethod · 0.45
GetNextInternalMethod · 0.45
ComputeMethod · 0.45
ApplyRewritesFunction · 0.45
AddToHistogramMethod · 0.45

Calls 7

pop_backMethod · 0.80
notify_allMethod · 0.80
waitMethod · 0.45
emptyMethod · 0.45
sizeMethod · 0.45
push_backMethod · 0.45
backMethod · 0.45

Tested by 4

WriteCheckpointFunction · 0.36
ProcessBatchMethod · 0.36
RunnerThreadMethod · 0.36