Model Info

hbDNNGetModelNameList

int32_t hbDNNGetModelNameList(char const ***modelNameList, int32_t *modelNameCount, hbDNNPackedHandle_t dnnPackedHandle);

Get the name list and number of the models that dnnPackedHandle points to.

  • Parameter
    • [out] modelNameList List of model names.
    • [out] modelNameCount Number of model names.
    • [in] dnnPackedHandle Horizon DNN handle, pointing to multiple models.
  • Return Value
    • Return 0 means the API was successfully executed, otherwise the execution failed.

hbDNNGetModelHandle

int32_t hbDNNGetModelHandle(hbDNNHandle_t *dnnHandle, hbDNNPackedHandle_t dnnPackedHandle, char const *modelName);

Get the handle of a model from the model list that dnnPackedHandle points to. The caller can use the returned dnnHandle across functions and threads.

  • Parameter
    • [out] dnnHandle DNN handle, pointing to one model.
    • [in] dnnPackedHandle DNN handle, pointing to multiple models.
    • [in] modelName Model name.
  • Return Value
    • Return 0 means the API was successfully executed, otherwise the execution failed.

hbDNNGetInputCount

int32_t hbDNNGetInputCount(int32_t *inputCount, hbDNNHandle_t dnnHandle);

Get the number of the input tensors of the model that dnnHandle points to.

  • Parameter
    • [out] inputCount Number of input tensors of the model.
    • [in] dnnHandle DNN handle, pointing to one model.
  • Return Value
    • Return 0 means the API was successfully executed, otherwise the execution failed.

hbDNNGetInputName

int32_t hbDNNGetInputName(char const **name, hbDNNHandle_t dnnHandle, int32_t inputIndex);

Get the name of the input tensors of the model that dnnHandle points to.

  • Parameter
    • [out] name Name of the input tensor of the model.
    • [in] dnnHandle DNN handle, pointing to one model.
    • [in] inputIndex Index of the input tensor of the model.
  • Return Value
    • Return 0 means the API was successfully executed, otherwise the execution failed.

hbDNNGetInputTensorProperties

int32_t hbDNNGetInputTensorProperties(hbDNNTensorProperties *properties, hbDNNHandle_t dnnHandle, int32_t inputIndex);

Get the property of the specific input tensor of the model that dnnHandle points to.

  • Parameter
    • [out] properties Info of the input tensor.
    • [in] dnnHandle DNN handle, pointing to one model.
    • [in] inputIndex Index of the input tensor of the model.
  • Return Value
    • Return 0 means the API was successfully executed, otherwise the execution failed.

hbDNNGetOutputCount

int32_t hbDNNGetOutputCount(int32_t *outputCount, hbDNNHandle_t dnnHandle);

Get the number of the output tensors of the model that dnnHandle points to.

  • Parameter
    • [out] outputCount Number of the output tensors of the model.
    • [in] dnnHandle DNN handle, pointing to one model.
  • Return Value
    • Return 0 means the API was successfully executed, otherwise the execution failed.

hbDNNGetOutputName

int32_t hbDNNGetOutputName(char const **name, hbDNNHandle_t dnnHandle, int32_t outputIndex);

Get the names of the output tensors of the model that dnnHandle points to.

  • Parameter
    • [out] name Name of the output tensor of the model.
    • [in] dnnHandle DNN handle, pointing to one model.
    • [in] outputIndex Index of the output tensor of the model.
  • Return Value
    • Return 0 means the API was successfully executed, otherwise the execution failed.

hbDNNGetOutputTensorProperties

int32_t hbDNNGetOutputTensorProperties(hbDNNTensorProperties *properties, hbDNNHandle_t dnnHandle, int32_t outputIndex);

Get the property of the specific output tensor of the model that dnnHandle points to.

  • Parameter
    • [out] properties Info of the output tensor.
    • [in] dnnHandle DNN handle, pointing to one model.
    • [in] outputIndex Index of the output tensor of the model.
  • Return Value
    • Return 0 means the API was successfully executed, otherwise the execution failed.

hbDNNGetInputDesc

int32_t hbDNNGetInputDesc(char const **desc, uint32_t *size, int32_t *type, hbDNNHandle_t dnnHandle, int32_t inputIndex);

Get the description information associated with the specific input of the model that dnnHandle points to.

  • Parameter
    • [out] desc Address of the description information.
    • [out] size Size of the description information.
    • [out] type Type of the description information, please refer to hbDNNDescType.
    • [in] dnnHandle DNN handle, pointing to one model.
    • [in] inputIndex Index of the input tensor of the model.
  • Return Value
    • Return 0 means the API was successfully executed, otherwise the execution failed.

hbDNNGetOutputDesc

int32_t hbDNNGetOutputDesc(char const **desc, uint32_t *size, int32_t *type, hbDNNHandle_t dnnHandle, int32_t outputIndex);

Get the description information associated with the specific output of the model that dnnHandle points to.

  • Parameter
    • [out] desc Address of the description information.
    • [out] size Size of the description information.
    • [out] type Type of the description information, please refer to hbDNNDescType.
    • [in] dnnHandle DNN handle, pointing to one model.
    • [in] outputIndex Index of the output tensor of the model.
  • Return Value
    • Return 0 means the API was successfully executed, otherwise the execution failed.

hbDNNGetModelDesc

int32_t hbDNNGetModelDesc(char const **desc, uint32_t *size, int32_t *type, hbDNNHandle_t dnnHandle);

Get the description information associated with the model that dnnHandle points to.

  • Parameter
    • [out] desc Address of the description information.
    • [out] size Size of the description information.
    • [out] type Type of the description information, please refer to hbDNNDescType.
    • [in] dnnHandle DNN handle, pointing to one model.
  • Return Value
    • Return 0 means the API was successfully executed, otherwise the execution failed.

hbDNNGetCompileBpuCoreNum

int32_t hbDNNGetCompileBpuCoreNum(int32_t *bpuCoreNum, hbDNNHandle_t dnnHandle);

Get the number of BPU cores at compile time associated with the model that dnnHandle points to.

  • Parameter
    • [out] bpuCoreNum The number of BPU cores at compile time.
    • [in] dnnHandle DNN handle, pointing to one model.
  • Return Value
    • Return 0 means the API was successfully executed, otherwise the execution failed.
Note

When the obtained bpuCoreNum value is greater than 1, the model is a multi-core model.

When calling hbUCPSubmitTask to submit a multi-core model task, ensure that the number of BPU cores in the control parameter hbUCPSchedParam.backend is exactly equal to bpuCoreNum obtained through this interface. Setting HB_UCP_CORE_ANY or HB_UCP_BPU_CORE_ANY is not allowed.

For example, when the obtained bpuCoreNum value is 2, you need to set hbUCPSchedParam.backend = HB_UCP_BPU_CORE_0 | HB_UCP_BPU_CORE_1. This setting method is understood as running the model on HB_UCP_BPU_CORE_0 and HB_UCP_BPU_CORE_1. Note that this is different from the setting method of selecting two backends during single-core model inference.

hbDNNGetHBMDesc

int32_t hbDNNGetHBMDesc(char const **desc, uint32_t *size, int32_t *type, hbDNNPackedHandle_t dnnPackedHandle, int32_t index);

Get the description information associated with the hbm that dnnPackedHandle and index points to.

  • Parameter
    • [out] desc Address of the description information.
    • [out] size Size of the description information.
    • [out] type Type of the description information, please refer to hbDNNDescType.
    • [in] dnnPackedHandle Horizon DNN handle, pointing to multiple models.。
    • [in] index hbm index。
  • Return Value
    • Return 0 means the API was successfully executed, otherwise the execution failed.
Note

hbDNNInitializeFromFiles or hbDNNInitializeFromDDR can support loading multiple hbms at the same time, so the index range should be [0, modelFileCount) or [0, modelDataCount), here modelFileCount and modelDataCount are parameters of the two interface parameters respectively.