running node v16.15.1, tfjs-node v4.1.0 on Mac Big Sur
The model loaded with no error, failed on model.predict() ValueError: Error when checking model : the Array of Tensors that you are passing to your model is not the size the the model expected. Expected to see 1 Tensor(s), but instead got 0 Tensors(s).
model = await tfnode.loadLayersModel(`file://${modelPath}/model.json`)
console.log(`loading time: ${modelPath}, ${endTime-startTime}`);
let outputTensor = model.predict({input_tensor: inputTensor});
ValueError: Error when checking : expected conv2d_Conv2D1_input to have shape [null,28,28,1] but got array with shape [1,720,1280,3].
at new ValueError (/model-service/node_modules/@tensorflow/tfjs-layers/dist/tf-layers.node.js:276:28)
at checkInputData (/model-service/node_modules/@tensorflow/tfjs-layers/dist/tf-layers.node.js:32814:31)
at LayersModel.predict (/model-service/node_modules/@tensorflow/tfjs-layers/dist/tf-layers.node.js:33492:9)
at Sequential.predict (/model-service/node_modules/@tensorflow/tfjs-layers/dist/tf-layers.node.js:35309:27)
at Observable._subscribe (/model-service/index.js:155:32)
at Observable._trySubscribe (/model-service/node_modules/rxjs/dist/cjs/internal/Observable.js:71:25)
at Observable.subscribe (/model-service/node_modules/rxjs/dist/cjs/internal/Observable.js:36:30)
at _loop_1 (/model-service/node_modules/rxjs/dist/cjs/internal/observable/forkJoin.js:29:52)
at Observable._subscribe (/model-service/node_modules/rxjs/dist/cjs/internal/observable/forkJoin.js:45:13)
at Observable._trySubscribe (/model-service/node_modules/rxjs/dist/cjs/internal/Observable.js:71:25)
if tried with model.predict(inputTensor.reshape([null,28,28,1]))
Error: Invalid TF_Status: 3
Message: Input to reshape is a tensor with 2764800 values, but the requested shape has 0
model.predict(tf.tensor(inputTensor));
Error: values passed to tensor(values) must be a number/boolean/string or an array of numbers/booleans/strings, or a TypedArray
at makeTensor (/model-service/node_modules/@tensorflow/tfjs-core/dist/tf-core.node.js:5620:15)
at Object.tensor (/model-service/node_modules/@tensorflow/tfjs-core/dist/tf-core.node.js:5758:12)
at Observable._subscribe (/model-service/index.js:156:47)
at Observable._trySubscribe (/model-service/node_modules/rxjs/dist/cjs/internal/Observable.js:71:25)
at Observable.subscribe (/model-service/node_modules/rxjs/dist/cjs/internal/Observable.js:36:30)
at _loop_1 (/model-service/node_modules/rxjs/dist/cjs/internal/observable/forkJoin.js:29:52)
at Observable._subscribe (/model-service/node_modules/rxjs/dist/cjs/internal/observable/forkJoin.js:45:13)
at Observable._trySubscribe (/model-service/node_modules/rxjs/dist/cjs/internal/Observable.js:71:25)
at Observable.subscribe (/model-service/node_modules/rxjs/dist/cjs/internal/Observable.js:36:30)