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

Function kernelFunc

tfjs-backend-wasm/src/kernels/unary_kernel.ts:36–50  ·  view source on GitHub ↗
(args: {backend: BackendWasm, inputs: UnaryInputs})

Source from the content-addressed store, hash-verified

34 }
35
36 function kernelFunc(args: {backend: BackendWasm, inputs: UnaryInputs}):
37 TensorInfo {
38 const {backend, inputs: {x}} = args;
39 const xId = backend.dataIdMap.get(x.dataId).id;
40 const out = backend.makeOutput(x.shape, outType || x.dtype);
41 const outId = backend.dataIdMap.get(out.dataId).id;
42
43 // Short-circuit zero-sized tensors.
44 if (util.sizeFromShape(out.shape) === 0) {
45 return out;
46 }
47
48 wasmFunc(xId, CppDType[x.dtype], outId);
49 return out;
50 }
51
52 return {kernelName, backendName: 'wasm', setupFunc, kernelFunc};
53}

Callers

nothing calls this directly

Calls 2

getMethod · 0.45
makeOutputMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…