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

Method ready

tfjs-core/src/engine.ts:188–209  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

186 }
187
188 async ready(): Promise<void> {
189 if (this.pendingBackendInit != null) {
190 return this.pendingBackendInit.then(() => {});
191 }
192 if (this.backendInstance != null) {
193 return;
194 }
195 const sortedBackends = this.getSortedBackends();
196
197 for (let i = 0; i < sortedBackends.length; i++) {
198 const backendName = sortedBackends[i];
199 const success = await this.initializeBackend(backendName).success;
200 if (success) {
201 await this.setBackend(backendName);
202 return;
203 }
204 }
205
206 throw new Error(
207 `Could not initialize any backends, all backend initializations ` +
208 `failed.`);
209 }
210
211 get backend(): KernelBackend {
212 if (this.pendingBackendInit != null) {

Callers 9

componentDidMountMethod · 0.80
readyFunction · 0.80
engine_test.tsFile · 0.80
metadata.tsFile · 0.80
mainFunction · 0.80
mainFunction · 0.80
mainFunction · 0.80

Calls 3

getSortedBackendsMethod · 0.95
initializeBackendMethod · 0.95
setBackendMethod · 0.95

Tested by

no test coverage detected