MCPcopy Index your code
hub / github.com/tensorflow/tfjs / checkShape

Method checkShape

tfjs-layers/src/models.ts:421–429  ·  view source on GitHub ↗
(layer: Layer)

Source from the content-addressed store, hash-verified

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.

Callers 1

addMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected