MCPcopy Index your code
hub / github.com/tensorflow/tfjs / disposeData

Method disposeData

tfjs-backend-cpu/src/backend_cpu.ts:176–193  ·  view source on GitHub ↗

* Dispose the memory if the dataId has 0 refCount. Return true if the memory * is released or memory is not managed in this backend, false if memory is * not cleared. * @param dataId * @oaram force Optional, remove the data regardless of refCount

(dataId: DataId, force = false)

Source from the content-addressed store, hash-verified

174 * @oaram force Optional, remove the data regardless of refCount
175 */
176 override disposeData(dataId: DataId, force = false): boolean {
177 if (this.data.has(dataId)) {
178 this.data.get(dataId).refCount--;
179 if (!force && this.data.get(dataId).refCount > 0) {
180 return false;
181 }
182
183 const {complexTensorInfos} = this.data.get(dataId);
184
185 if (complexTensorInfos != null) {
186 this.disposeData(complexTensorInfos.real.dataId, true);
187 this.disposeData(complexTensorInfos.imag.dataId, true);
188 }
189
190 this.data.delete(dataId);
191 }
192 return true;
193 }
194
195 disposeIntermediateTensorInfo(tensorInfo: TensorInfo): void {
196 this.disposeData(tensorInfo.dataId);

Callers 1

Calls 3

hasMethod · 0.80
deleteMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected