Binary

The binary operator has a collection of basic binary calculation, like add, substraction and times. A binary operator do element-wise calculation on two input tensors and store result in output tensor.

Few notes:

  • The inputTensors should exactly have 2 tensors and outputTensors should have 1 tensor.
  • All input and output tensors should have same shape.

All binary operators can be initialized:

let op = SomeBinaryOp()



List

AddOperator

For input tensors a and b, output tensor c: \(c = a+b\)

SubOperator

For input tensors a and b, output tensor c: \(c = a-b\)

MultOperator

For input tensors a and b, output tensor c: \(c = a \times b\)

DivOperator

For input tensors a and b, output tensor c: \(c = a / b\)

RDivOperator

For input tensors a and b, output tensor c: \(c = b / a\)

RDivOperator

For input tensors a and b, output tensor c: \(c = b / a\)

PowOperator

For input tensors a and b, output tensor c: \(c = a^{b}\)