Skip to main content

ClikaRT::ops::sub

function

2 overloads.

sub(Tensor, ScalarOrTensor, double, Activation)

Tensor sub(
    Tensor a,
    ScalarOrTensor other,
    double alpha = 1.0,
    Activation activation = Activation::Identity
)

Subtracts other (scaled) from a elementwise.

out=act(aαother)out = act(a - \alpha \cdot other)

Broadcasts and promotes as add; alpha (default 1.0) scales other before the subtract, and activation is the same fused float-only epilogue (default Activation::Identity).

Returns: the broadcast-shaped difference at the promoted dtype.

Throws

  • ClikaRT::Error: (INVALID_ARGUMENT) when the operand shapes are not broadcast-compatible. Also raises (INVALID_ARGUMENT) for a non-float activation operand dtype.

Declared in ClikaRT/compute/ops.h, line 1537

sub(Scalar, Tensor, double, Activation)

Tensor sub(
    Scalar a,
    Tensor b,
    double alpha = 1.0,
    Activation activation = Activation::Identity
)

Scalar-LHS act(aαb)act(a - \alpha \cdot b). a keeps its kind (see Scalar). The parameter set mirrors the tensor-first form: alpha scales the TENSOR operand b, activation applies to the result.

Declared in ClikaRT/compute/ops.h, line 1544