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

Method FlushUnlocked

tensorflow/core/kernels/conditional_accumulator_base.cc:168–188  ·  view source on GitHub ↗

* Try to flush logged, blocked TakeGrad attempts. */

Source from the content-addressed store, hash-verified

166 * Try to flush logged, blocked TakeGrad attempts.
167 */
168void ConditionalAccumulatorBase::FlushUnlocked() {
169 std::vector<CleanUp> clean_up;
170 Ref();
171 {
172 mutex_lock lock(mu_);
173 bool changed;
174 do {
175 changed = TryAttemptLocked(&clean_up);
176 } while (changed);
177 }
178 Unref();
179 for (const auto& to_clean : clean_up) {
180 if (to_clean.to_deregister != CancellationManager::kInvalidToken) {
181 // NOTE(mrry): We can safely ignore the return value of
182 // DeregisterCallback because the mutex mu_ ensures that the
183 // cleanup action only executes once.
184 to_clean.cm->DeregisterCallback(to_clean.to_deregister);
185 }
186 to_clean.finished();
187 }
188}
189
190bool ConditionalAccumulatorBase::TakeGradLockedHelper(OpKernelContext* ctx,
191 DoneCallback callback) {

Callers

nothing calls this directly

Calls 2

DeregisterCallbackMethod · 0.80
finishedMethod · 0.80

Tested by

no test coverage detected