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

Method removeBackend

tfjs-core/src/engine.ts:371–395  ·  view source on GitHub ↗
(backendName: string)

Source from the content-addressed store, hash-verified

369 }
370
371 removeBackend(backendName: string): void {
372 if (!(backendName in this.registryFactory)) {
373 throw new Error(`${backendName} backend not found in registry`);
374 }
375 if (this.backendName === backendName && this.pendingBackendInit != null) {
376 // There is a pending promise of the backend we want to remove. Make it
377 // obsolete.
378 this.pendingBackendInitId++;
379 }
380
381 if (backendName in this.registry) {
382 this.disposeRegisteredKernels(backendName);
383 this.registry[backendName].dispose();
384 delete this.registry[backendName];
385 }
386
387 delete this.registryFactory[backendName];
388
389 // Unset the backend if it is active.
390 if (this.backendName === backendName) {
391 this.pendingBackendInit = null;
392 this.backendName = null;
393 this.backendInstance = null;
394 }
395 }
396
397 private getSortedBackends(): string[] {
398 if (Object.keys(this.registryFactory).length === 0) {

Callers 7

removeBackendFunction · 0.80
engine_test.tsFile · 0.80
resetBackendFunction · 0.80

Calls 2

disposeMethod · 0.45

Tested by

no test coverage detected