Struct anira::v2::ModelData#

struct ModelData#

One model entry of a 2.x configuration: a path (m_is_binary false; the characters are owned by the object) or model bytes (m_is_binary true; borrowed, the caller’s buffer outlives every configuration and handler built from it, as in 2.x), the backend, and the entry point of a LibTorch or ExecuTorch file.

Public Functions

inline ModelData(void *data, size_t size, InferenceBackend backend, std::string model_function = "", bool is_binary = true)#
Throws:

Error{ANIRA_ERROR_INVALID_ARGUMENT} – for NULL data or a size of 0 (2.x asserted).

inline ModelData(const std::string &model_path, InferenceBackend backend, const std::string &model_function = "", bool is_binary = false)#
inline ModelData(const ModelData &other)#
inline ModelData(ModelData &&other) noexcept#
inline ModelData &operator=(const ModelData &other)#
inline ModelData &operator=(ModelData &&other) noexcept#
~ModelData() = default#
inline bool operator==(const ModelData &other) const noexcept#

The 2.x rule: size, backend and kind equal, then the bytes by pointer or the path by content; the entry point is not compared.

inline bool operator!=(const ModelData &other) const noexcept#

Public Members

void *m_data#

the bytes, or the path’s characters (not NUL-terminated)

size_t m_size#

the byte count, or the path’s length

InferenceBackend m_backend#

the backend that runs the entry

std::string m_model_function#

the entry point (LibTorch, ExecuTorch); empty = default

bool m_is_binary#

bytes (true) or a path (false)