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

Method runKernel

tfjs-core/src/engine.ts:539–555  ·  view source on GitHub ↗

* Execute a kernel with the given name and return the output tensor. * * @param kernelName The name of the kernel to execute. * @param inputs A map of input names to tensors. * @param attrs A map of attribute names to their values. An attribute is a * primitive (non-tensor) input

(
      kernelName: string, inputs: NamedTensorMap, attrs?: NamedAttrMap)

Source from the content-addressed store, hash-verified

537 * tensors are not visible to the user.
538 */
539 runKernel<T extends Tensor|Tensor[]>(
540 kernelName: string, inputs: NamedTensorMap, attrs?: NamedAttrMap): T {
541 if (this.backendName == null) {
542 // backend has not been initialized yet (backend initialization is lazy
543 // can be deferred until an op/ kernel is run).
544 // The below getter has side effects that will try to initialize the
545 // backend and set properties like this.backendName
546 // tslint:disable-next-line: no-unused-expression
547 this.backend;
548 }
549 const hasKernel = getKernel(kernelName, this.backendName) != null;
550 if (!hasKernel) {
551 throw new Error(`Kernel '${kernelName}' not registered for backend '${
552 this.backendName}'`);
553 }
554 return this.runKernelFunc({kernelName, inputs, attrs});
555 }
556
557 private shouldCheckForMemLeaks(): boolean {
558 return this.ENV.getBool('IS_TEST');

Callers 15

Reshape_test.tsFile · 0.80
cloneMethod · 0.80
gradMethod · 0.80
addFunction · 0.80
engine_test.tsFile · 0.80
zFunction · 0.80
Dilation2D_grad.tsFile · 0.80
imagesDerFunction · 0.80
Elu_grad.tsFile · 0.80
imagesDerFunction · 0.80
greater_Function · 0.80

Calls 2

runKernelFuncMethod · 0.95
getKernelFunction · 0.90

Tested by

no test coverage detected