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

Method moveData

tfjs-core/src/engine.ts:424–439  ·  view source on GitHub ↗
(backend: KernelBackend, dataId: DataId)

Source from the content-addressed store, hash-verified

422 }
423
424 moveData(backend: KernelBackend, dataId: DataId) {
425 const info = this.state.tensorInfo.get(dataId);
426 const srcBackend = info.backend;
427 const values = this.readSync(dataId);
428 const refCount = srcBackend.refCount(dataId);
429 // Delete the tensor from the old backend and move it to the new
430 // backend.
431 srcBackend.disposeData(dataId, true);
432 info.backend = backend;
433 backend.move(dataId, values, info.shape, info.dtype, refCount);
434 if (this.shouldCheckForMemLeaks()) {
435 // Track the number of moves during a kernel execution to correctly
436 // detect memory leaks.
437 this.state.numDataMovesStack[this.state.numDataMovesStack.length - 1]++;
438 }
439 }
440
441 tidy<T extends TensorContainer>(nameOrFn: string|ScopeFn<T>, fn?: ScopeFn<T>):
442 T {

Callers

nothing calls this directly

Calls 6

readSyncMethod · 0.95
refCountMethod · 0.65
disposeDataMethod · 0.65
moveMethod · 0.65
getMethod · 0.45

Tested by

no test coverage detected