model.h

Overview

Provides model-related APIs for model creation and inference.

Since: 9

Related Modules:

MindSpore

Summary

Structs

Name Description
OH_AI_TensorHandleArray Defines the tensor array structure, which is used to store the tensor array pointer and tensor array length.
OH_AI_ShapeInfo Defines dimension information. The maximum dimension is set by MS_MAX_SHAPE_NUM.
OH_AI_CallBackParam Defines the operator information passed in a callback.

Macros

Name Description
OH_AI_MAX_SHAPE_NUM 32 Defines dimension information. The maximum dimension is set by MS_MAX_SHAPE_NUM.

Types

Name Description
OH_AI_ModelHandle Defines the pointer to a model object.
OH_AI_TensorHandleArray Defines the tensor array structure, which is used to store the tensor array pointer and tensor array length.
OH_AI_ShapeInfo Defines dimension information. The maximum dimension is set by MS_MAX_SHAPE_NUM.
OH_AI_CallBackParam Defines the operator information passed in a callback.
OH_AI_KernelCallBack) (const OH_AI_TensorHandleArray inputs, const OH_AI_TensorHandleArray outputs, const OH_AI_CallBackParam kernel_Info) Defines the pointer to a callback.

Functions

Name Description
OH_AI_ModelCreate () Creates a model object.
OH_AI_ModelDestroy (OH_AI_ModelHandle *model) Destroys a model object.
OH_AI_ModelBuild (OH_AI_ModelHandle model, const void *model_data, size_t data_size, OH_AI_ModelType model_type, const OH_AI_ContextHandle model_context) Loads and builds a MindSpore model from the memory buffer.
OH_AI_ModelBuildFromFile (OH_AI_ModelHandle model, const char *model_path, OH_AI_ModelType model_type, const OH_AI_ContextHandle model_context) Loads and builds a MindSpore model from a model file.
OH_AI_ModelResize (OH_AI_ModelHandle model, const OH_AI_TensorHandleArray inputs, OH_AI_ShapeInfo *shape_infos, size_t shape_info_num) Adjusts the input tensor shapes of a built model.
OH_AI_ModelPredict (OH_AI_ModelHandle model, const OH_AI_TensorHandleArray inputs, OH_AI_TensorHandleArray *outputs, const OH_AI_KernelCallBack before, const OH_AI_KernelCallBack after) Performs model inference.
OH_AI_ModelGetInputs (const OH_AI_ModelHandle model) Obtains the input tensor array structure of a model.
OH_AI_ModelGetOutputs (const OH_AI_ModelHandle model) Obtains the output tensor array structure of a model.
OH_AI_ModelGetInputByTensorName (const OH_AI_ModelHandle model, const char *tensor_name) Obtains the input tensor of a model by tensor name.
OH_AI_ModelGetOutputByTensorName (const OH_AI_ModelHandle model, const char *tensor_name) Obtains the output tensor of a model by tensor name.