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

Function step

tfjs-backend-webgl/src/kernels/Step.ts:23–35  ·  view source on GitHub ↗
(
    {inputs, attrs, backend}:
        {inputs: UnaryInputs, attrs: StepAttrs, backend: MathBackendWebGL})

Source from the content-addressed store, hash-verified

21import {CHECK_NAN_SNIPPET, UnaryOpProgram} from '../unaryop_gpu';
22
23export function step(
24 {inputs, attrs, backend}:
25 {inputs: UnaryInputs, attrs: StepAttrs, backend: MathBackendWebGL}):
26 TensorInfo {
27 const {x} = inputs;
28 const opSnippet = CHECK_NAN_SNIPPET + `
29 return x > 0.0 ? 1.0 : float(${attrs.alpha});
30 `;
31
32 const program = new UnaryOpProgram(x.shape, opSnippet);
33
34 return backend.runWebGLProgram(program, [x], x.dtype);
35}
36
37export const stepConfig: KernelConfig = {
38 kernelName: Step,

Callers

nothing calls this directly

Calls 1

runWebGLProgramMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…