MCPcopy
hub / github.com/tensorflow/tfjs / pop

Method pop

tfjs-layers/src/models.ts:562–580  ·  view source on GitHub ↗

* Removes the last layer in the model. * * @exception TypeError if there are no layers in the model.

()

Source from the content-addressed store, hash-verified

560 * @exception TypeError if there are no layers in the model.
561 */
562 pop(): void {
563 if (this.layers.length === 0) {
564 throw new TypeError('There are no layers in the model.');
565 }
566
567 this.layers.pop();
568 if (this.layers.length === 0) {
569 this.outputs = [];
570 this.inboundNodes = [];
571 this.outboundNodes = [];
572 } else {
573 const lastLayerIndex = this.layers.length - 1;
574 this.layers[lastLayerIndex].outboundNodes = [];
575 this.outputs = [this.layers[lastLayerIndex].output as SymbolicTensor];
576 // update self.inbound_nodes
577 this.inboundNodes[0].outputTensors = this.outputs;
578 this.inboundNodes[0].outputShapes = [this.outputs[0].shape];
579 }
580 }
581
582 override call(inputs: Tensor|Tensor[], kwargs: Kwargs): Tensor|Tensor[] {
583 if (this.model == null) {

Callers 15

nameScopeFunction · 0.45
models_test.tsFile · 0.45
dotFunction · 0.45
createIndicesFunction · 0.45
acquireBufferMethod · 0.45
releaseBufferMethod · 0.45
endScopeMethod · 0.45
prepareAndValidateFunction · 0.45
stridesWithElidedDimsFunction · 0.45
nonMaxSuppressionImpl_Function · 0.45
acquireTextureMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected