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

Method backend

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

Source from the content-addressed store, hash-verified

209 }
210
211 get backend(): KernelBackend {
212 if (this.pendingBackendInit != null) {
213 throw new Error(
214 `Backend '${this.backendName}' has not yet been initialized. Make ` +
215 `sure to await tf.ready() or await tf.setBackend() before calling ` +
216 `other methods`);
217 }
218 if (this.backendInstance == null) {
219 const {name, asyncInit} = this.initializeBackendsAndReturnBest();
220 if (asyncInit) {
221 throw new Error(
222 `The highest priority backend '${name}' has not yet been ` +
223 `initialized. Make sure to await tf.ready() or ` +
224 `await tf.setBackend() before calling other methods`);
225 }
226 this.setBackend(name);
227 }
228 return this.backendInstance;
229 }
230
231 backendNames(): string[] {
232 return Object.keys(this.registryFactory);

Callers 15

run_tests.tsFile · 0.80
createTensorFromGPUTestFunction · 0.80
engine_test.tsFile · 0.80
abs_test.tsFile · 0.80
backend_test.tsFile · 0.80

Calls 2

setBackendMethod · 0.95

Tested by

no test coverage detected