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

Function ClearDecrefCache

tensorflow/python/lib/core/ndarray_tensor_bridge.cc:52–61  ·  view source on GitHub ↗

Actually dereferences cached numpy arrays. REQUIRES being called while holding the GIL.

Source from the content-addressed store, hash-verified

50// Actually dereferences cached numpy arrays. REQUIRES being called while
51// holding the GIL.
52void ClearDecrefCache() {
53 std::vector<void*> cache_copy;
54 {
55 mutex_lock ml(*DelayedDecrefLock());
56 cache_copy.swap(*DecrefCache());
57 }
58 for (void* obj : cache_copy) {
59 Py_DECREF(reinterpret_cast<PyObject*>(obj));
60 }
61}
62
63// Structure which keeps a reference to a Tensor alive while numpy has a pointer
64// to it.

Callers 10

TF_Run_wrapper_helperFunction · 0.85
TF_Run_wrapperFunction · 0.85
TF_SessionRunCallableFunction · 0.85
TF_PRun_wrapperFunction · 0.85
TF_SessionRun_wrapperFunction · 0.85
TF_SessionPRun_wrapperFunction · 0.85
EagerTensor_deallocFunction · 0.85
ComputeMethod · 0.85

Calls 3

DelayedDecrefLockFunction · 0.85
DecrefCacheFunction · 0.85
swapMethod · 0.45

Tested by

no test coverage detected