Class anira::TensorSpec#

class TensorSpec#

One input or output of the model: your canonical name, the data type, the role, the tagged axes in the model’s memory order, and, for a streamed tensor, the window and overlap it is consumed with. Move-only; copied into a ModelConfig by input()/output().

Public Functions

inline TensorSpec(std::string_view name, DType dtype, Role role)#

= anira_tensor_spec_create.

Throws:

Error – when the C entry refuses the arguments.

inline ~TensorSpec()#
TensorSpec(const TensorSpec&) = delete#
TensorSpec &operator=(const TensorSpec&) = delete#
inline TensorSpec(TensorSpec &&other) noexcept#
inline TensorSpec &operator=(TensorSpec &&other) noexcept#
inline TensorSpec &axis(uint32_t i, AxisTag tag, int64_t extent)#

Axis i (model memory order) with its tag and extent (ANIRA_DYNAMIC on a streamed Time axis).

Throws:

Error{ANIRA_ERROR_INVALID_ARGUMENT} –

inline TensorSpec &window(int64_t window_min, int64_t window_max, int64_t overlap)#

Streamed only: elements along the Time axis per inference and the overlap kept. Optional: without it the window is derived at validation (the fixed Time extent, or a flexible window pinned to the anchor hop on a dynamic Time axis); an overlap needs a window.

inline TensorSpec &time_ratio(int64_t num, int64_t den)#

Time advance against the anchor: num elements per den anchor elements.

inline TensorSpec &latency(int64_t latency_elements)#

Outputs only: the model’s internal delay along the Time axis.

inline TensorSpec &state_source(std::string_view output_canonical)#

State inputs only (role ANIRA_ROLE_STATE): the canonical name of the state output this input is fed from on the next inference (anira_tensor_spec_set_state_source). Both halves of the pair carry the role, the pairing is stated here, once; the name is resolved when the model is validated.

Throws:

Error{ANIRA_ERROR_INVALID_ARGUMENT} – for an empty name or a spec of another role.

template<class Ext>
inline TensorSpec &ext(const Ext &value)#

An extension record (section 1b); copied.

inline TensorSpec &ext_json(std::string_view kind, std::string_view utf8)#

The JSON twin of ext(): a kind and its JSON text.

inline SpecView view() const noexcept#

What the spec holds so far, through the one read path of SpecView; valid while this object lives.

inline const anira_tensor_spec *native() const noexcept#
inline anira_tensor_spec *native() noexcept#