(layer: Layer)
| 419 | // Helper function to Sequential.add Throws if the new output shape will be |
| 420 | // invalid. |
| 421 | private checkShape(layer: Layer) { |
| 422 | const shape = layer.inboundNodes[0].outputTensors[0].shape; |
| 423 | if (shape.some(x => x < 0)) { |
| 424 | throw new ValueError( |
| 425 | 'Negative dimension size caused by adding layer ' + |
| 426 | `${layer.name} with input shape [` + |
| 427 | `${layer.inboundNodes[0].inputTensors[0].shape}]`); |
| 428 | } |
| 429 | } |
| 430 | |
| 431 | /** |
| 432 | * Adds a layer instance on top of the layer stack. |