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


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
-
context Exclusive 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
-
context Zero-initialized noncopyable owner. settings Resolved ONNX configuration; values are consumed during open. adapter Required application ABI, or NULL when the caller validates it separately. error Writable failure diagnostic. capacity Available 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
-
context Open owner with one declared image tensor. image Borrowed immutable pixels valid for this call only. error Writable failure diagnostic. capacity Available 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
-
context Exclusive open model owner. error Writable failure diagnostic. capacity Available 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
-
filename Immutable input path during hashing. digest Destination 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
-
model Parsed descriptor with comma-separated labels. category Zero-based class index. label Writable nontruncated class name. capacity Available 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
-
model Destination with name storage backing its own tensor views. contents Destructively parsed input with at least length+1 writable bytes. length Input bytes excluding the writable terminator. error Writable failure diagnostic. capacity Available 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
-
model Destination contract; discard it on failure. descriptor SENSORAIA_MODEL_V1 flat INI path. graph Graph whose bytes must match the descriptor hash. error Writable failure diagnostic. capacity Available bytes in error.
- Returns
- True for a complete descriptor and matching graph identity.
Definition at line 258 of file inference_model.c.