MCPcopy
hub / github.com/tensorflow/tfjs / checkMapInputs

Method checkMapInputs

tfjs-tflite/src/tflite_model.ts:279–298  ·  view source on GitHub ↗
(
      inputTensorNames: string[], modelInputNames: string[])

Source from the content-addressed store, hash-verified

277 }
278
279 private checkMapInputs(
280 inputTensorNames: string[], modelInputNames: string[]) {
281 const notInModel =
282 inputTensorNames.filter(name => !modelInputNames.includes(name));
283 const notInInput =
284 modelInputNames.filter(name => !inputTensorNames.includes(name));
285 if (notInModel.length === 0 && notInInput.length === 0) {
286 return;
287 }
288
289 const msgParts =
290 ['The model input names don\'t match the model input names.'];
291 if (notInModel.length > 0) {
292 msgParts.push(`Names in input but missing in model: [${notInModel}].`);
293 }
294 if (notInInput.length > 0) {
295 msgParts.push(`Names in model but missing in inputs: [${notInInput}].`);
296 }
297 throw new Error(msgParts.join(' '));
298 }
299
300 private getShapeFromTFLiteTensorInfo(info: TFLiteWebModelRunnerTensorInfo) {
301 return info.shape.split(',').map(s => Number(s));

Callers 1

predictMethod · 0.95

Calls 2

joinMethod · 0.80
pushMethod · 0.45

Tested by

no test coverage detected