Skip to main content

ClikaRT::ops::sub

function

2 overloads.

sub(Tensor, ScalarOrTensor, double, Activation)​

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

Subtracts other (scaled) from input 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 1549

sub(Scalar, Tensor, double, Activation)​

Tensor sub(
    Scalar input,
    Tensor other,
    double alpha = 1.0,
    Activation activation = Activation::Identity
)

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

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