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

Function registerMonitor

tfjs-core/src/io/progress.ts:39–48  ·  view source on GitHub ↗
(promise: Promise<T>)

Source from the content-addressed store, hash-verified

37 let resolvedPromise = 0;
38
39 const registerMonitor = (promise: Promise<T>) => {
40 promise.then(value => {
41 const fraction = startFraction +
42 ++resolvedPromise / promises.length * (endFraction - startFraction);
43 // pass fraction as parameter to callback function.
44 onProgress(fraction);
45 return value;
46 });
47 return promise;
48 };
49
50 function checkPromises(promises: Array<Promise<T>>): void {
51 assert(

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…