HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ML_Model Class Reference

#include <ML_Model.h>

Public Types

using Shape = UT_Array< int64 >
 

Public Member Functions

 ML_Model ()
 
 ~ML_Model ()
 
bool initializeModel (const UT_StringRef &model_filepath, ML_ExecutionProvider provider, UT_WorkBuffer &errors, UT_WorkBuffer &warnings, UT_WorkBuffer &messages)
 
bool run (const UT_Array< UT_Array< float >> &inputs, const UT_Array< Shape > &input_shapes, UT_Array< UT_Array< float >> &outputs, const UT_Array< Shape > &output_shapes, UT_WorkBuffer &error_message)
 
void getNames (UT_StringArray &input_names, UT_StringArray &output_names) const
 
void getShapes (UT_Array< Shape > &input_shapes, UT_Array< Shape > &output_shapes) const
 

Static Public Member Functions

static exint tensorElementsSize (const UT_Array< exint > &tensor_dimensions, bool &has_dynamic_axes)
 
static bool mat3ToShape (Shape &tensor_shape, const UT_Matrix3D &shape_vector)
 
static bool parseOutputData (const UT_StringHolder &srcpattern, int maxtuplesize, UT_StringArray &names, UT_IntArray &sizes, UT_WorkBuffer &error)
 
static bool supportsExecutionProvider (ML_ExecutionProvider provider)
 
static const UT_Array
< ML_ExecutionProvider > & 
supportedExecutionProviders ()
 
static void executionProviderName (ML_ExecutionProvider provider, UT_StringHolder &name, UT_StringHolder &label)
 Returns a human-readable name for an exection provider. More...
 

Detailed Description

Definition at line 22 of file ML_Model.h.

Member Typedef Documentation

Definition at line 30 of file ML_Model.h.

Constructor & Destructor Documentation

ML_Model::ML_Model ( )
ML_Model::~ML_Model ( )

Member Function Documentation

static void ML_Model::executionProviderName ( ML_ExecutionProvider  provider,
UT_StringHolder name,
UT_StringHolder label 
)
static

Returns a human-readable name for an exection provider.

void ML_Model::getNames ( UT_StringArray input_names,
UT_StringArray output_names 
) const
void ML_Model::getShapes ( UT_Array< Shape > &  input_shapes,
UT_Array< Shape > &  output_shapes 
) const
bool ML_Model::initializeModel ( const UT_StringRef model_filepath,
ML_ExecutionProvider  provider,
UT_WorkBuffer errors,
UT_WorkBuffer warnings,
UT_WorkBuffer messages 
)

Initializer for the ML_Model class

Parameters
model_filepathcontains the path to the ONNX model
providerdetermines which execution provider to use
errorsis meant to hold any error strings that may be generated from an error occurring during initialization
static bool ML_Model::mat3ToShape ( Shape tensor_shape,
const UT_Matrix3D shape_vector 
)
static

This is a function for acquiring the shape of a tensor from the parameters.

Parameters
tensor_shapethe array to fill with the shape.
static bool ML_Model::parseOutputData ( const UT_StringHolder srcpattern,
int  maxtuplesize,
UT_StringArray names,
UT_IntArray sizes,
UT_WorkBuffer error 
)
static

Parses the output data for nodes

Parameters
maxtuplesize-1 for unlimited
bool ML_Model::run ( const UT_Array< UT_Array< float >> &  inputs,
const UT_Array< Shape > &  input_shapes,
UT_Array< UT_Array< float >> &  outputs,
const UT_Array< Shape > &  output_shapes,
UT_WorkBuffer error_message 
)
static const UT_Array<ML_ExecutionProvider>& ML_Model::supportedExecutionProviders ( )
static

Returns a cached list of support execution providers for the current system configuration

static bool ML_Model::supportsExecutionProvider ( ML_ExecutionProvider  provider)
static

Returns true if the specified provider is supported by the current platform and system configuration

static exint ML_Model::tensorElementsSize ( const UT_Array< exint > &  tensor_dimensions,
bool &  has_dynamic_axes 
)
static

Gets the product of all non-dynamic axes of a tensor shape. Places a bool in a variable to determine if dynamic axes were found Any dimensions being zero will return 0

Returns
1 if all axes are dynamic

The documentation for this class was generated from the following file: