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, bool usecuda, UT_WorkBuffer &errors, UT_WorkBuffer &warnings)
 
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)
 

Detailed Description

Definition at line 20 of file ML_Model.h.

Member Typedef Documentation

Definition at line 28 of file ML_Model.h.

Constructor & Destructor Documentation

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

Member Function Documentation

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,
bool  usecuda,
UT_WorkBuffer errors,
UT_WorkBuffer warnings 
)

Initializer for the ML_Model class

Parameters
model_filepathcontains the path to the ONNX model
usecudawill trigger if we add the cuda provider or not.
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 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: