()
| 547 | } |
| 548 | |
| 549 | override get trainableWeights(): LayerVariable[] { |
| 550 | // Porting Note: This check below is to prevent errors where the |
| 551 | // _trainableWeights inherited from the parent class (Layer) gets |
| 552 | // inadvertently used. |
| 553 | if (this._trainableWeights.length > 0) { |
| 554 | throw new ValueError( |
| 555 | 'Container instance unexpectedly contains _trainableWeights.' + |
| 556 | 'The trainable weights of a Container are a union of the ' + |
| 557 | 'trainable weights of its consituent Layers. Its own ' + |
| 558 | '_trainableWeights must remain an empty Array.'); |
| 559 | } |
| 560 | |
| 561 | if (!this.trainable) { |
| 562 | return []; |
| 563 | } |
| 564 | let weights: LayerVariable[] = []; |
| 565 | for (const layer of this.layers) { |
| 566 | weights = weights.concat(layer.trainableWeights); |
| 567 | } |
| 568 | return weights; |
| 569 | } |
| 570 | |
| 571 | override get nonTrainableWeights(): LayerVariable[] { |
| 572 | const weights: LayerVariable[] = []; |
nothing calls this directly
no test coverage detected
searching dependent graphs…