(backend: KernelBackend, dataId: DataId)
| 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 { |
nothing calls this directly
no test coverage detected