Skip to main content

ClikaRT::ops::ScalarOrTensor

class

Header: ClikaRT/compute/ops.h

A ClikaRT-level value type (NOT op-layer machinery): one optional slot that carries a scalar (double / integer) OR a tensor. Every ctor is implicit on purpose. Pass a bare double, an integer, a Tensor, or std::nullopt straight to a ScalarOrTensor parameter; spelling the wrap at a call site (ops::ScalarOrTensor(x)) is redundant noise. ops::ScalarOrTensor remains a valid spelling via the alias below.

Member functions

ScalarOrTensor()

ScalarOrTensor() =default

Absent: the "not provided" state for optional scalar-or-tensor parameters (a kernel-launch bound, an optional clip limit). An absent value tells the op to derive its own default.

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

ScalarOrTensor(nullopt_t)

ScalarOrTensor(std::nullopt_t)

Absent, spelled std::nullopt at a call site (same meaning as the default ctor).

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

ScalarOrTensor(double)

ScalarOrTensor(double scalar)

A double scalar operand.

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

ScalarOrTensor(T)

template <``typename T, typename std::enable_if<std::is_integral<T>::value, int>::type = 0``>
ScalarOrTensor(T v)

Integral values keep their integer-ness across the boundary: an integer-typed gateway slot (a split size, an index literal) rejects a float literal, so {n * d, ...} must not decay to double. Templated over the integral types so every width lands here exactly, never on the double ctor, and never ambiguously against it.

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

ScalarOrTensor(optional<int64_t>)

ScalarOrTensor(std::optional<std::int64_t> v)

std::optional<int64_t> maps nullopt → absent, a value → the int arm, so a caller holding an optional config int passes it directly.

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

ScalarOrTensor(optional<double>)

ScalarOrTensor(std::optional<double> v)

std::optional<double> maps nullopt → absent, a value → the scalar arm (the double sibling of the optional-int ctor above).

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

ScalarOrTensor(Tensor)

ScalarOrTensor(Tensor tensor)

A full tensor operand; the slot then broadcasts like any tensor input.

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

has_value()

bool has_value() const

True when a value is present (absent tells the op to derive its own default).

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

is_tensor()

bool is_tensor() const

True when the slot carries a tensor.

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

is_int()

bool is_int() const

True when the slot carries an integer (kept integral, never decayed to double).

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

scalar()

double scalar() const

The double value; meaningful when present and neither tensor nor integer.

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

int_value()

std::int64_t int_value() const

The integer value; meaningful when is_int().

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

tensor()

const Tensor& tensor() const

The tensor operand; meaningful when is_tensor().

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