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

Function createSimpleUnaryImpl

tfjs-backend-cpu/src/utils/unary_impl.ts:25–36  ·  view source on GitHub ↗
(op: SimpleUnaryOperation<I, O>)

Source from the content-addressed store, hash-verified

23 * Template that creates implementation for unary op.
24 */
25export function createSimpleUnaryImpl<I extends number | string = number,
26 O extends number | string = number>(op: SimpleUnaryOperation<I, O>):
27 SimpleUnaryImpl<I, O> {
28 return (values, dtype, attrs) => {
29 const newValues =
30 util.getArrayFromDType(dtype, values.length);
31 for (let i = 0; i < values.length; ++i) {
32 newValues[i] = op(values[i], attrs);
33 }
34 return newValues;
35 };
36}

Callers 10

unaryKernelFuncFunction · 0.90
Floor.tsFile · 0.90
Expm1.tsFile · 0.90
Ceil.tsFile · 0.90
Rsqrt.tsFile · 0.90
Sigmoid.tsFile · 0.90
Sqrt.tsFile · 0.90
Exp.tsFile · 0.90
Log.tsFile · 0.90

Calls 1

opFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…