MCPcopy Create free account
hub / github.com/tensorflow/tfjs / trainableWeights

Function trainableWeights

tfjs-layers/src/engine/container.ts:549–569  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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[] = [];

Callers

nothing calls this directly

Calls 1

concatMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…