Skip to main content

ClikaRT::ops::div

function

2 overloads.

div(Tensor, ScalarOrTensor, RoundingMode, Activation)

Tensor div(
    Tensor a,
    ScalarOrTensor other,
    RoundingMode rounding_mode = RoundingMode::None,
    Activation activation = Activation::Identity
)

Divides a by other elementwise, with an optional quotient rounding.

out=act(roundmode(a/other))out = act(round_{mode}(a / other))

Broadcasts and promotes as add.

Parameters

  • a: dividend tensor.
  • other: divisor: tensor or scalar literal.
  • rounding_mode: RoundingMode::None (default) is true division; Trunc rounds the quotient toward zero; Floor toward -inf (ops::floor_divide is exactly div with Floor).
  • activation: fused float-only epilogue applied AFTER the rounding, in the same kernel pass; default Activation::Identity.

Returns: the broadcast-shaped quotient 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.

    auto q = ClikaRT::ops::div(a, b); // true division
    auto f = ClikaRT::ops::div(a, b, ClikaRT::ops::RoundingMode::Floor);

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

div(Scalar, Tensor, RoundingMode, Activation)

Tensor div(
    Scalar a,
    Tensor b,
    RoundingMode rounding_mode = RoundingMode::None,
    Activation activation = Activation::Identity
)

Scalar-LHS a / b. a keeps its kind (see Scalar). The parameter set mirrors the tensor-first form: rounding_mode picks true/trunc/floor division, activation applies to the result.

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