holoscan::ops::InferenceOpParams
holoscan::ops::InferenceOpParams
Compile-time-authored configuration for InferenceOp.
Configuration is supplied as one immutable aggregate when the Operator is instantiated on the authoring Graph (graph.op<InferenceOp>("name", ``InferenceOpParams``{...})). InferenceOp::setup() reads params() to dynamically declare one Input<Tensor>/Output<Tensor> port per configured tensor name (see inference.cpp).
Static methods
from_yaml
Loads an InferenceOpParams aggregate from a YAML file.
The YAML schema is 1:1 with the fields of this struct:
Every top-level key is optional except model_path_map, input_map, and output_map; absent scalar/bool keys fall back to the member’s in-class default shown above. The cuda_stream_pool and cuda_green_context_pool sub-maps are the only keys that construct real resource objects (holoscan::CudaStreamPool / holoscan::CudaGreenContextPool, respectively) rather than populating a plain-data field; when a sub-map is absent, the corresponding shared_ptr member stays null, matching a default-constructed InferenceOpParams.
Returns: The populated InferenceOpParams.
Throws: std::runtime_error if the file cannot be read/parsed, or a required key (model_path_map, input_map, output_map) is missing.
Parameters
Path to a YAML file matching the schema above.
Example
from_yaml_node
Load an InferenceOpParams aggregate from an already-parsed YAML sub-node.
Use this when a single YAML file configures multiple operators — each operator’s parameters live under a named key at the file’s root. from_yaml_node() reads that subtree and produces the aggregate; config_dir is the directory that relative model_path_map paths resolve against (typically the parent of the YAML file that node was loaded from).
The subtree schema below the named key is identical to what from_yaml() accepts at the root — the same required + optional keys and the same behavior for absent keys.
from_yaml(path) is now a thin wrapper: it loads the file, uses the file’s parent as config_dir, and calls from_yaml_node(root, parent). Existing single-op YAMLs (where the file’s root is the InferenceOp’s section) keep working unchanged.
Returns: The populated InferenceOpParams.
Throws: std::runtime_error if a required key (model_path_map, input_map, output_map) is missing from node.
Parameters
YAML node containing the InferenceOp parameter subtree (as documented above).
Directory used to resolve relative model_path_map paths. Absolute paths pass through unchanged.
Example