oveRTOS C++ API
C++20 RAII wrappers for the oveRTOS C API
Loading...
Searching...
No Matches
Public Member Functions | List of all members
ove::Model< ArenaSize > Class Template Reference

RAII wrapper for an ML inference model session. More...

#include <infer.hpp>

Public Member Functions

 Model (const struct ove_model_config &cfg)
 Construct a model from the given configuration.
 
 Model (const Model &)=delete
 
Modeloperator= (const Model &)=delete
 
 Model (Model &&other) noexcept
 Move constructor — transfers handle ownership; source becomes empty.
 
Modeloperator= (Model &&other) noexcept
 Move-assignment — destroys current model, then takes other's handle.
 
Result< void > invoke () noexcept
 Run the model forward pass.
 
template<typename T >
T * input_data (unsigned int index=0)
 Get a typed pointer to input tensor data; nullptr on failure.
 
template<typename T >
const T * output_data (unsigned int index=0) const
 Get a typed pointer to output tensor data (const); nullptr on failure.
 
Result< struct ove_tensor_info > input (unsigned int index) const noexcept
 Get full tensor descriptor for an input.
 
Result< struct ove_tensor_info > output (unsigned int index) const noexcept
 Get full tensor descriptor for an output.
 
uint64_t last_inference_us () const
 Return last inference duration in microseconds.
 
ove_model_t handle () const
 Access the underlying C handle.
 

Detailed Description

template<size_t ArenaSize = 0>
class ove::Model< ArenaSize >

RAII wrapper for an ML inference model session.

Wraps the C ove_model_* API with automatic resource management. In zero-heap mode, storage and arena are embedded as class members. In heap mode, they are allocated from the backend heap.

Template Parameters
ArenaSizeTensor arena size in bytes (only used in zero-heap mode for the embedded arena array; in heap mode this is supplied via the config).

Constructor & Destructor Documentation

◆ Model()

template<size_t ArenaSize = 0>
ove::Model< ArenaSize >::Model ( const struct ove_model_config &  cfg)
inlineexplicit

Construct a model from the given configuration.

Loads the FlatBuffer model and allocates tensors. Asserts on failure (embedded systems typically cannot recover from model load failure).

Member Function Documentation

◆ invoke()

template<size_t ArenaSize = 0>
Result< void > ove::Model< ArenaSize >::invoke ( )
inlinenoexcept

Run the model forward pass.

Returns
Empty Result<void> on success; unexpected Error on failure.

◆ input()

template<size_t ArenaSize = 0>
Result< struct ove_tensor_info > ove::Model< ArenaSize >::input ( unsigned int  index) const
inlinenoexcept

Get full tensor descriptor for an input.

Returns
On success, the populated ove_tensor_info. On failure, an unexpected Error.

The documentation for this class was generated from the following file: