I found a benchmark tool from tensorflow document: TensorFlow.js Model Benchmark 3 .
From the test result, run that model just costs 15ms. I was so curious that I try to find out what happen on that profile function. It seems like the profile function just called model.predict() and did not get the result out with tensor.data() or tensor.array() function:
function getPredictFnForModel(model, input) {
 ...
  } else if (model instanceof tf.LayersModel) {
    predict = () => model.predict(input);
  } else {
...
  return predict;
}

Now I’m confuse, how can I get the real time cost of model inference process, model.predict() or model.predict() + tensor.data()?