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

Function timeModelInference

e2e/benchmarks/benchmark_util.js:210–213  ·  view source on GitHub ↗

* Executes the predict function for `model` (`model.predict` for tf.LayersModel * and `model.executeAsync` for tf.GraphModel) and times the inference process * for `numRuns` rounds. Then returns a promise that resolves with information * about the model's inference time: * - `times`: an array of

(model, input, numRuns = 1)

Source from the content-addressed store, hash-verified

208 * @param numRuns The number of rounds for timing the inference process.
209 */
210async function timeModelInference(model, input, numRuns = 1) {
211 const predict = getPredictFnForModel(model, input);
212 return timeInference(predict, numRuns);
213}
214
215/**
216 * Executes `predict()` and times the inference process for `numRuns` rounds.

Callers 1

benchmarkModelFunction · 0.85

Calls 2

getPredictFnForModelFunction · 0.85
timeInferenceFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…