(inputShape?: Shape|Shape[])
| 587 | } |
| 588 | |
| 589 | override build(inputShape?: Shape|Shape[]) { |
| 590 | // Call `getExactlyOneShape` without using its return value, |
| 591 | // to verify that exactly one input shape is provided. |
| 592 | getExactlyOneShape(inputShape); |
| 593 | |
| 594 | if (this.inputs.length === 0 || this.outputs.length === 0) { |
| 595 | throw new TypeError( |
| 596 | 'Sequential model cannot be built: model is empty.' + |
| 597 | ' Add some layers first.'); |
| 598 | } |
| 599 | // actually create the model |
| 600 | this.model = new LayersModel({ |
| 601 | inputs: this.inputs, |
| 602 | outputs: this.outputs[0], |
| 603 | name: this.name + '_model' |
| 604 | }); |
| 605 | this.model.trainable = this.trainable; |
| 606 | |
| 607 | // mirror model attributes |
| 608 | this.supportsMasking = this.model.supportsMasking; |
| 609 | // TODO(michaelterry): Add caches |
| 610 | this.inputLayers = this.model.inputLayers; |
| 611 | this.inputLayersNodeIndices = this.model.inputLayersNodeIndices; |
| 612 | this.inputLayersTensorIndices = this.model.inputLayersTensorIndices; |
| 613 | this.outputLayers = this.model.outputLayers; |
| 614 | this.outputLayersNodeIndices = this.model.outputLayersNodeIndices; |
| 615 | this.outputLayersTensorIndices = this.model.outputLayersTensorIndices; |
| 616 | this.nodesByDepth = this.model.nodesByDepth; |
| 617 | this.containerNodes = this.model.containerNodes; |
| 618 | this.outputNames = this.model.outputNames; |
| 619 | this.inputNames = this.model.inputNames; |
| 620 | // TODO(michaelterry): Add feedInputNames, feedInputs, if needed. |
| 621 | // TODO(michaelterry): Add callbackModel if needed. |
| 622 | this.built = true; |
| 623 | } |
| 624 | |
| 625 | override countParams(): number { |
| 626 | if (!this.built) { |
no test coverage detected