* Attempt to dispose a LayersModel's weights. * * This method decrease the reference count of the LayersModel object by 1. * * A LayersModel is reference-counted. Its reference count is incremented by 1 * when it is first constructed and when it is used as a Layer of another * Laye
()
| 515 | * already been disposed. |
| 516 | */ |
| 517 | override dispose(): DisposeResult { |
| 518 | this.assertNotDisposed(); |
| 519 | const result: |
| 520 | DisposeResult = {refCountAfterDispose: null, numDisposedVariables: 0}; |
| 521 | if (--this._refCount === 0) { |
| 522 | for (const layer of this.layers) { |
| 523 | result.numDisposedVariables += layer.dispose().numDisposedVariables; |
| 524 | } |
| 525 | |
| 526 | // Call dispose on each internally created container layer again to ensure |
| 527 | // their refCounts hit zero and their tensors are subsequently deleted. |
| 528 | for (const container of this.internalContainerRefs) { |
| 529 | result.numDisposedVariables += container.dispose().numDisposedVariables; |
| 530 | } |
| 531 | } |
| 532 | result.refCountAfterDispose = this._refCount; |
| 533 | return result; |
| 534 | } |
| 535 | |
| 536 | override get trainable() { |
| 537 | return this.trainable_; |
nothing calls this directly
no test coverage detected
searching dependent graphs…