Skip to main content

ClikaRT::FakeTensor

class

Header: ClikaRT/compute/fake_tensor.h

FakeTensor: a metadata-only tensor with a shape, a dtype, a placement, and a quantized flag, with NO storage and no data pointer. It is the descriptor a custom op's shape rule reads (its inputs) and returns (its outputs). Each dimension is a spec::SymInt, so a shape rule composes dimensions and declares data-dependent (bounded) extents exactly as the runtime does, and the same rule serves a concrete (eager) and a symbolic (traced) call. "Metadata only" is a type guarantee here: there is structurally no way to read element data.

A value type (no out-of-line surface): it holds a vector<spec::SymInt>, a dtype, a copyable Stream, and a flag, all ABI-stable, so it crosses by layout.

Member functions

FakeTensor()

FakeTensor(
    std::vector<spec::SymInt> shape,
    DataType dtype,
    StreamOrDevice where = {},
    bool is_quantized = false
)

where places the (output) tensor; pass an input's stream() so the result lives alongside it (a bare device takes the calling thread's current lane on it; unspecified takes the ambient placement, else the current lane on the CPU). is_quantized marks the metadata as carrying a quantization scheme (the scheme itself is not modeled here).

Declared in ClikaRT/compute/fake_tensor.h, line 34

shape()

const std::vector<spec::SymInt>& shape() const noexcept

the symbolic-or-concrete dims

Declared in ClikaRT/compute/fake_tensor.h, line 41

dim()

const spec::SymInt& dim(std::int64_t i) const

one dim (no bounds check)

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

rank()

std::int64_t rank() const noexcept

the dim count

Declared in ClikaRT/compute/fake_tensor.h, line 43

numel()

spec::SymInt numel() const

The element count, the symbolic-aware product of the dimensions.

Declared in ClikaRT/compute/fake_tensor.h, line 46

dtype()

DataType dtype() const noexcept

the element dtype

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

stream()

Stream stream() const

the placement stream

Declared in ClikaRT/compute/fake_tensor.h, line 55

device()

Device device() const

the placement device (the stream's)

Declared in ClikaRT/compute/fake_tensor.h, line 56

is_quantized()

bool is_quantized() const noexcept

whether the described tensor is quantized

Declared in ClikaRT/compute/fake_tensor.h, line 57