Package com.helix.core.ml
Class OnnxFeatureExtractor
java.lang.Object
com.helix.core.ml.OnnxFeatureExtractor
Extracts and transforms runtime execution context features into native ONNX tensor buffers.
Validates schema alignment against OnnxModelDescriptor.inputFeatures(), safely coerces
mixed numeric and boolean types into single-precision float representations, and constructs
zero-copy 2D arrays ready for OnnxTensor allocation.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionai.onnxruntime.OnnxTensorcreateTensor(ai.onnxruntime.OrtEnvironment env, OnnxModelDescriptor descriptor, ExecutionContext context) Constructs a nativeOnnxTensorfor a single-row inference request.ai.onnxruntime.OnnxTensorcreateTensor(ai.onnxruntime.OrtEnvironment env, OnnxModelDescriptor descriptor, List<ExecutionContext> contexts) Constructs a nativeOnnxTensorfor a batch inference request.float[][]extractBatchFeatures(OnnxModelDescriptor descriptor, List<ExecutionContext> contexts) Extracts an ordered 2D batch feature matrix for multiple execution contexts.float[]extractFeatures(OnnxModelDescriptor descriptor, ExecutionContext context) Extracts an ordered feature vector for a single execution context.
-
Constructor Details
-
OnnxFeatureExtractor
public OnnxFeatureExtractor()
-
-
Method Details
-
extractFeatures
Extracts an ordered feature vector for a single execution context.- Parameters:
descriptor- target ONNX model descriptorcontext- runtime evaluation context- Returns:
- 1D float array of model input features
- Throws:
IllegalArgumentException- if a required feature is missing or cannot be coerced to float
-
extractBatchFeatures
public float[][] extractBatchFeatures(OnnxModelDescriptor descriptor, List<ExecutionContext> contexts) Extracts an ordered 2D batch feature matrix for multiple execution contexts.- Parameters:
descriptor- target ONNX model descriptorcontexts- list of execution contexts- Returns:
- 2D float array with shape [batch_size, feature_count]
-
createTensor
public ai.onnxruntime.OnnxTensor createTensor(ai.onnxruntime.OrtEnvironment env, OnnxModelDescriptor descriptor, ExecutionContext context) throws ai.onnxruntime.OrtException Constructs a nativeOnnxTensorfor a single-row inference request.- Parameters:
env- active ONNX Runtime environmentdescriptor- target ONNX model descriptorcontext- single evaluation context- Returns:
- allocated native ONNX tensor buffer with shape [1, feature_count]
- Throws:
ai.onnxruntime.OrtException- if native tensor allocation fails
-
createTensor
public ai.onnxruntime.OnnxTensor createTensor(ai.onnxruntime.OrtEnvironment env, OnnxModelDescriptor descriptor, List<ExecutionContext> contexts) throws ai.onnxruntime.OrtException Constructs a nativeOnnxTensorfor a batch inference request.- Parameters:
env- active ONNX Runtime environmentdescriptor- target ONNX model descriptorcontexts- batch of evaluation contexts- Returns:
- allocated native ONNX tensor buffer with shape [batch_size, feature_count]
- Throws:
ai.onnxruntime.OrtException- if native tensor allocation fails
-