c_cpp Hi3559A插件层写法

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了c_cpp Hi3559A插件层写法相关的知识,希望对你有一定的参考价值。

#include "hi_plugin.h"
#include "string.h"
#include <stdio.h>
//返回插件层类型
//只需要修改LayerType
//参数:pszNodeType 输出层Type
//      u32Length   Type字符长度
HI_S32 HI_NodePlugin_getNodeType(HI_CHAR pszNodeType[],const HI_U32 u32Length)
{
  HI_U32 u32ProposalLength = strlen("LayerType");
  if(u32Length < sizeof("LayerType")){
    printf("The paramter u32Length is too small\n");
    return HI_FAILURE;
  }
  strncpy(pszNodeType, "LayerType",u32ProposalLength);
  pszNodeType[u32ProposalLength] = '\0';
  return HI_SUCCESS;
}

//类似于TensorRT的enqueue成员函数
//参数:pstInputs 输入节点结构体
//      u32InputNum 个数

HI_S32 HI_NodePlugin_Compute(const HI_NodePlugin_Operand_S *pstInputs,HI_U32 u32InputNum,
                            HI_NodePlugin_Operand_S *pstOutputs,HI_U32 u32Outputs,HI_NodePlugin_NodeParam_S* pstHyperParam,HI_NodePlugin_NodeParam_S* pstTrainingParam)
                            {
                              
                              return HI_SUCCESS;
                            }














以上是关于c_cpp Hi3559A插件层写法的主要内容,如果未能解决你的问题,请参考以下文章