* Removes the last layer in the model. * * @exception TypeError if there are no layers in the model.
()
| 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) { |
no outgoing calls
no test coverage detected