Unary

The unary operator has a collection of basic unary calculation, like Absolute, trigonometric functions etc. An unary operator do element-wise calculation on each input tensor and store result in corresponding output tensor.

Few notes:

  • The inputTensors and outputTensors should have same number of tensors.
  • Corresponding input and output tensors should have same shapes.

All unary operators can be initialized:

let op = SomeUnaryOp()



Trigonometric

SinOperator

For each input tensor x and output tensor y: \(y = sin(x)\)

SinhOperator

For each input tensor x and output tensor y: \(y = sinh(x)\)

TanOperator

For each input tensor x and output tensor y: \(y = tan(x)\)

TanhOperator

For each input tensor x and output tensor y: \(y = tanh(x)\)

CosOperator

For each input tensor x and output tensor y: \(y = cos(x)\)

CoshOperator

For each input tensor x and output tensor y: \(y = cosh(x)\)

ArcsinOperator

For each input tensor x and output tensor y: \(y = acsin(x)\)

ArcsinhOperator

For each input tensor x and output tensor y: \(y = acsinh(x)\)

ArccosOperator

For each input tensor x and output tensor y: \(y = arccos(x)\)

ArccosOperator

For each input tensor x and output tensor y: \(y = arccos(x)\)

ArccoshOperator

For each input tensor x and output tensor y: \(y = arctanh(x)\)

ArctanhOperator

For each input tensor x and output tensor y: \(y = arctanh(x)\)

DegreeOperator

Convert radians to degrees. For each input tensor x and output tensor y: \(y = x \times 180/ \pi\)

RadianOperator

Convert degree to radian. For each input tensor x and output tensor y: \(y = x \times \pi / 180\)

Round and abs

FloorOperator

For each input tensor x and output tensor y: \(y = floor(x)\)

CeilOperator

For each input tensor x and output tensor y: \(y = ceil(x)\)

RintOperator

Operator computes element-wise rounded value to the nearest integer of the input. For each input tensor x and output tensor y: \(y = rint(x)\)

RoundOperator

Operator computes element-wise rounded value to the truncating integers of input values. For each input tensor x and output tensor y: \(y = round(x)\)

AbsOperator

Compute element-wise abs values of input tensors. For each input tensor x and output tensor y: \(y =abs(x)\)

Exponential, sqrt and logarithm

SquareOperator

For each input tensor x and output tensor y: \(y = x \times x\)

SqrtOperator

For each input tensor x and output tensor y: \(y = sqrt(x)\)

ExpOperator

For each input tensor x and output tensor y: \(y = e^{x}\)

Expm1Operator

For each input tensor x and output tensor y: \(y = e^{x} - 1\)

RsqrtOperator

For each input tensor x and output tensor y: \(y = 1 / sqrt(x)\)

LogOperator

For each input tensor x and output tensor y: \(y = log_{e}(x)\)

Log2Operator

For each input tensor x and output tensor y: \(y = log_{2}(x)\)

Log10Operator

For each input tensor x and output tensor y: \(y = log_{10}(x)\)

Log1pOperator

For each input tensor x and output tensor y: \(y = log_{e}(1+x)\)