MCPcopy Create free account
hub / github.com/tensorflow/tfjs / warnOnIncompatibleInputShape

Function warnOnIncompatibleInputShape

tfjs-layers/src/engine/topology.ts:1091–1116  ·  view source on GitHub ↗

* Check compatibility between input shape and this layer's batchInputShape. * * Print warning if any incompatibility is found. * * @param inputShape Input shape to be checked.

(inputShape: Shape)

Source from the content-addressed store, hash-verified

1089 * @param inputShape Input shape to be checked.
1090 */
1091 protected warnOnIncompatibleInputShape(inputShape: Shape) {
1092 if (this.batchInputShape == null) {
1093 return;
1094 } else if (inputShape.length !== this.batchInputShape.length) {
1095 console.warn(
1096 `The rank of the input tensor provided (shape: ` +
1097 `${JSON.stringify(inputShape)}) does not match that of the ` +
1098 `batchInputShape (${JSON.stringify(this.batchInputShape)}) ` +
1099 `of the layer ${this.name}`);
1100 } else {
1101 let dimMismatch = false;
1102 this.batchInputShape.forEach((dimension, i) => {
1103 if (dimension != null && inputShape[i] != null &&
1104 inputShape[i] !== dimension) {
1105 dimMismatch = true;
1106 }
1107 });
1108 if (dimMismatch) {
1109 console.warn(
1110 `The shape of the input tensor ` +
1111 `(${JSON.stringify(inputShape)}) does not ` +
1112 `match the expectation of layer ${this.name}: ` +
1113 `${JSON.stringify(this.batchInputShape)}`);
1114 }
1115 }
1116 }
1117
1118 /**
1119 * Retrieves the output shape(s) of a layer.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…