Illustrated C/C++ source sheets, symbol index, API relationship graph, compiler console and debug trace

LIVE AI / FLEXIBLE SENSING / FLIGHT CONTEXT

Sensoraia API

Live AI and sensing, connected to the flight.
See, listen, inspect and return supported results while airborne.

Loading...
Searching...
No Matches
inference_model.h File Reference

Integrity-checked model contracts and independently owned tensor workspaces. More...

Include dependency graph for inference_model.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  inference_model
 Parsed descriptor with self-referencing tensor-name pointers; do not copy after parsing. More...
struct  inference_context
 Independent, noncopyable model owner; mapped tensor buffers and session are reused between jobs. More...

Functions

bool inference_model_read (struct inference_model *model, const char *descriptor, const char *graph, char *error, size_t capacity)
 Load a bounded descriptor and verify its exact graph digest; hashes are not authentication.
bool inference_model_parse (struct inference_model *model, char *contents, size_t length, char *error, size_t capacity)
 Parse a descriptor, not graph bytes; graph integrity remains a separate read-time check.
bool inference_file_sha256 (const char *filename, char digest[65])
 Hash a stable nonempty regular file using bounded streaming scratch.
bool inference_model_label (const struct inference_model *model, unsigned category, char *label, size_t capacity)
 Resolve one model-owned label without retaining a pointer into a mutable list.
bool inference_context_open (struct inference_context *context, const struct inference_settings *settings, const char *adapter, char *error, size_t capacity)
 Verify a bundle, map bounded tensors and bind one warm session.
bool inference_context_run (struct inference_context *context, char *error, size_t capacity)
 Run the currently prepared tensors using the context's timeout policy.
bool inference_context_prepare_image (struct inference_context *context, const struct inference_image *image, char *error, size_t capacity)
 Prepare a single image input without running the model, so camera leases can be released first.
void inference_context_close (struct inference_context *context)
 Release the session before unmapping its borrowed tensor storage.

Detailed Description

Integrity-checked model contracts and independently owned tensor workspaces.

Definition in file inference_model.h.

Function Documentation

◆ inference_context_close()

void inference_context_close ( struct inference_context * context)

Release the session before unmapping its borrowed tensor storage.

Parameters
contextExclusive owner; NULL and repeated closes are harmless.

Definition at line 373 of file inference_model.c.

◆ inference_context_open()

bool inference_context_open ( struct inference_context * context,
const struct inference_settings * settings,
const char * adapter,
char * error,
size_t capacity )

Verify a bundle, map bounded tensors and bind one warm session.

Parameters
contextZero-initialized noncopyable owner.
settingsResolved ONNX configuration; values are consumed during open.
adapterRequired application ABI, or NULL when the caller validates it separately.
errorWritable failure diagnostic.
capacityAvailable bytes in error.
Returns
True after the graph can use this context's tensor buffers.
Note
Mapping tensor storage does not make ORT allocations heap-free or bound whole-board RAM.

Definition at line 277 of file inference_model.c.

◆ inference_context_prepare_image()

bool inference_context_prepare_image ( struct inference_context * context,
const struct inference_image * image,
char * error,
size_t capacity )

Prepare a single image input without running the model, so camera leases can be released first.

Parameters
contextOpen owner with one declared image tensor.
imageBorrowed immutable pixels valid for this call only.
errorWritable failure diagnostic.
capacityAvailable bytes in error.
Returns
True after filling input storage and its source-coordinate transform.

Definition at line 361 of file inference_model.c.

◆ inference_context_run()

bool inference_context_run ( struct inference_context * context,
char * error,
size_t capacity )

Run the currently prepared tensors using the context's timeout policy.

Parameters
contextExclusive open model owner.
errorWritable failure diagnostic.
capacityAvailable bytes in error.
Returns
True for valid completed output; ignore output on failure.

Definition at line 346 of file inference_model.c.

◆ inference_file_sha256()

bool inference_file_sha256 ( const char * filename,
char digest[65] )

Hash a stable nonempty regular file using bounded streaming scratch.

Parameters
filenameImmutable input path during hashing.
digestDestination for 64 lowercase hex characters and a NUL.
Returns
True for a complete stable read; digest is undefined on failure.

Definition at line 41 of file inference_model.c.

◆ inference_model_label()

bool inference_model_label ( const struct inference_model * model,
unsigned category,
char * label,
size_t capacity )

Resolve one model-owned label without retaining a pointer into a mutable list.

Parameters
modelParsed descriptor with comma-separated labels.
categoryZero-based class index.
labelWritable nontruncated class name.
capacityAvailable bytes in label.
Returns
True when the requested label exists and fits.

Definition at line 237 of file inference_model.c.

◆ inference_model_parse()

bool inference_model_parse ( struct inference_model * model,
char * contents,
size_t length,
char * error,
size_t capacity )

Parse a descriptor, not graph bytes; graph integrity remains a separate read-time check.

Parameters
modelDestination with name storage backing its own tensor views.
contentsDestructively parsed input with at least length+1 writable bytes.
lengthInput bytes excluding the writable terminator.
errorWritable failure diagnostic.
capacityAvailable bytes in error.
Returns
True for supported schema, bounded concrete tensors and complete preprocessing.

Definition at line 189 of file inference_model.c.

◆ inference_model_read()

bool inference_model_read ( struct inference_model * model,
const char * descriptor,
const char * graph,
char * error,
size_t capacity )

Load a bounded descriptor and verify its exact graph digest; hashes are not authentication.

Parameters
modelDestination contract; discard it on failure.
descriptorSENSORAIA_MODEL_V1 flat INI path.
graphGraph whose bytes must match the descriptor hash.
errorWritable failure diagnostic.
capacityAvailable bytes in error.
Returns
True for a complete descriptor and matching graph identity.

Definition at line 258 of file inference_model.c.