function unaryKernelFunc({ opSnippet, packedOpSnippet, cpuKernelImpl, dtype }) {
    return ({ inputs, backend })=>{
        const { x } = inputs;
        const webglBackend = backend;
        const $dtype = dtype || x.dtype;
        if (webglBackend.shouldExecuteOnCPU([
            x
        ]) && cpuKernelImpl != null) {
            const xData = webglBackend.texData.get(x.dataId);
            const outValues = cpuKernelImpl(xData.values, $dtype);
            return webglBackend.makeTensorInfo(x.shape, $dtype, outValues);
        }
        const shouldUsePackedProgram = (0, _tfjsCore.env)().getBool("WEBGL_PACK_UNARY_OPERATIONS") && packedOpSnippet != null;
        let program;
        if (shouldUsePackedProgram) program = new (0, _unaryopPackedGpu.UnaryOpPackedProgram)(x.shape, packedOpSnippet);
        else program = new (0, _unaryopGpu.UnaryOpProgram)(x.shape, opSnippet);
        return webglBackend.runWebGLProgram(program, [
            x
        ], $dtype);
    };
}
Template that creates a `KernelFunc` for binary ops.
@param opSnippet Op snippet to create `BinaryOpProgram`.
@param packedOpSnippet Op snippet to create `BinaryOpPackedProgram`.
@param checkOutOfBoundsForPackedProgram Whether to set checkOutOfBounds=true
    when creating BinaryOpPackedProgram.
@param dtype Optional. If set, the result has this dtype. Otherwise, the
    result has the same dtype as the first input. This is mainly used in
    comparison kernels, such as Equal, Less, Greater, etc.