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

Method ClearCaches

tensorflow/core/common_runtime/eager/context.cc:154–172  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

152}
153
154void EagerContext::ClearCaches() {
155 {
156 mutex_lock ml(executor_map_mu_);
157 for (auto& entry : thread_local_executor_) {
158 entry.second->WaitForAllPendingNodes().IgnoreError();
159 }
160 }
161 {
162 // The executor stores pointers to kernels, so we need to make sure that no
163 // async eager ops are still executing. We lock the cache during this time
164 // as well.
165 mutex_lock ml(cache_mu_);
166 default_executor_.WaitForAllPendingNodes().IgnoreError();
167 kernel_cache_.clear();
168 for (auto& entry : registered_functions_) {
169 entry.second->cached_kernel_keys->clear();
170 }
171 }
172}
173
174void EagerContext::SetThreadLocalDevicePlacementPolicy(
175 ContextDevicePlacementPolicy policy) {

Callers 1

TFE_ContextClearCachesFunction · 0.80

Calls 3

IgnoreErrorMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected